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

Function FromFloat64

postgres/parser/json/json.go:1043–1050  ·  view source on GitHub ↗

FromFloat64 returns a JSON value given a float64.

(v float64)

Source from the content-addressed store, hash-verified

1041
1042// FromFloat64 returns a JSON value given a float64.
1043func FromFloat64(v float64) (JSON, error) {
1044 dec := apd.Decimal{}
1045 _, err := dec.SetFloat64(v)
1046 if err != nil {
1047 return nil, err
1048 }
1049 return jsonNumber(dec), nil
1050}
1051
1052// MakeJSON returns a JSON value given a Go-style representation of JSON.
1053// * JSON null is Go `nil`,

Callers 1

MakeJSONFunction · 0.70

Calls 1

jsonNumberTypeAlias · 0.85

Tested by

no test coverage detected