Value implements the [database/sql/driver.Valuer] interface.
()
| 225 | |
| 226 | // Value implements the [database/sql/driver.Valuer] interface. |
| 227 | func (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. |
| 240 | func (n Numeric) MarshalJSON() ([]byte, error) { |
nothing calls this directly
no test coverage detected