MCPcopy
hub / github.com/jackc/pgx / Value

Method Value

pgtype/numeric.go:227–237  ·  pgtype/numeric.go::Numeric.Value

Value implements the [database/sql/driver.Valuer] interface.

()

Source from the content-addressed store, hash-verified

225
226// Value implements the [database/sql/driver.Valuer] interface.
227func (n Numeric) Value() (driver.Value, error) {
228 if !n.Valid {
229 return nil, nil
230 }
231
232 buf, err := NumericCodec{}.PlanEncode(nil, 0, TextFormatCode, n).Encode(n, nil)
233 if err != nil {
234 return nil, err
235 }
236 return string(buf), err
237}
238
239// MarshalJSON implements the [encoding/json.Marshaler] interface.
240func (n Numeric) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls 2

EncodeMethod · 0.65
PlanEncodeMethod · 0.65

Tested by

no test coverage detected