MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / FromNumber

Function FromNumber

pkg/util/json/json.go:1882–1889  ·  view source on GitHub ↗

FromNumber returns a JSON value given a json.Number.

(v json.Number)

Source from the content-addressed store, hash-verified

1880
1881// FromNumber returns a JSON value given a json.Number.
1882func FromNumber(v json.Number) (JSON, error) {
1883 // The JSON decoder has already verified that the string `v` represents a
1884 // valid JSON number, and the set of valid JSON numbers is a [proper] subset
1885 // of the set of valid apd.Decimal values.
1886 dec := apd.Decimal{}
1887 _, _, err := dec.SetString(string(v))
1888 return jsonNumber(dec), err
1889}
1890
1891// FromString returns a JSON value given a string.
1892func FromString(v string) JSON {

Callers 4

parseTopValueMethod · 0.85
parseArrayValueMethod · 0.85
parseObjectValueMethod · 0.85
MakeJSONFunction · 0.85

Calls 2

jsonNumberTypeAlias · 0.85
SetStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…