MCPcopy Create free account
hub / github.com/dolthub/doltgresql / FromNumber

Function FromNumber

postgres/parser/json/json.go:972–979  ·  view source on GitHub ↗

FromNumber returns a JSON value given a json.Number.

(v json.Number)

Source from the content-addressed store, hash-verified

970
971// FromNumber returns a JSON value given a json.Number.
972func FromNumber(v json.Number) (JSON, error) {
973 // The JSON decoder has already verified that the string `v` represents a
974 // valid JSON number, and the set of valid JSON numbers is a [proper] subset
975 // of the set of valid apd.Decimal values.
976 dec := apd.Decimal{}
977 _, _, err := dec.SetString(string(v))
978 return jsonNumber(dec), err
979}
980
981// FromString returns a JSON value given a string.
982func FromString(v string) JSON {

Callers 1

MakeJSONFunction · 0.85

Calls 2

jsonNumberTypeAlias · 0.85
SetStringMethod · 0.80

Tested by

no test coverage detected