Documentation ¶
Overview ¶
Package json contains helper functions for encoding and decoding JSON.
Index ¶
- func DecodeDate(i *jx.Decoder) (v time.Time, err error)
- func DecodeDateTime(i *jx.Decoder) (v time.Time, err error)
- func DecodeDuration(i *jx.Decoder) (v time.Duration, err error)
- func DecodeIP(i *jx.Decoder) (v netip.Addr, err error)
- func DecodeStringInt32(d *jx.Decoder) (v int32, err error)
- func DecodeStringInt64(d *jx.Decoder) (v int64, err error)
- func DecodeStringUnixMicro(d *jx.Decoder) (time.Time, error)
- func DecodeStringUnixMilli(d *jx.Decoder) (time.Time, error)
- func DecodeStringUnixNano(d *jx.Decoder) (time.Time, error)
- func DecodeStringUnixSeconds(d *jx.Decoder) (time.Time, error)
- func DecodeTime(i *jx.Decoder) (v time.Time, err error)
- func DecodeURI(i *jx.Decoder) (v url.URL, err error)
- func DecodeUUID(i *jx.Decoder) (v uuid.UUID, err error)
- func DecodeUnixMicro(d *jx.Decoder) (time.Time, error)
- func DecodeUnixMilli(d *jx.Decoder) (time.Time, error)
- func DecodeUnixNano(d *jx.Decoder) (time.Time, error)
- func DecodeUnixSeconds(d *jx.Decoder) (time.Time, error)
- func Encode(m Marshaler) []byte
- func EncodeDate(s *jx.Encoder, v time.Time)
- func EncodeDateTime(s *jx.Encoder, v time.Time)
- func EncodeDuration(s *jx.Encoder, v time.Duration)
- func EncodeIP(s *jx.Encoder, v netip.Addr)
- func EncodeStringInt32(e *jx.Encoder, v int32)
- func EncodeStringInt64(e *jx.Encoder, v int64)
- func EncodeStringUnixMicro(e *jx.Encoder, v time.Time)
- func EncodeStringUnixMilli(e *jx.Encoder, v time.Time)
- func EncodeStringUnixNano(e *jx.Encoder, v time.Time)
- func EncodeStringUnixSeconds(e *jx.Encoder, v time.Time)
- func EncodeTime(s *jx.Encoder, v time.Time)
- func EncodeURI(s *jx.Encoder, v url.URL)
- func EncodeUUID(s *jx.Encoder, v uuid.UUID)
- func EncodeUnixMicro(e *jx.Encoder, v time.Time)
- func EncodeUnixMilli(e *jx.Encoder, v time.Time)
- func EncodeUnixNano(e *jx.Encoder, v time.Time)
- func EncodeUnixSeconds(e *jx.Encoder, v time.Time)
- func Equal(a, b []byte) (bool, error)
- func Marshal(val any) ([]byte, error)
- func Unmarshal(data []byte, val any) error
- type Marshaler
- type Nullable
- type Resettable
- type Settable
- type Unmarshaler
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeDate ¶
DecodeDate decodes date from json.
func DecodeDateTime ¶
DecodeDateTime decodes date-time from json.
func DecodeDuration ¶
DecodeDuration decodes duration from json.
func DecodeStringInt32 ¶ added in v0.29.0
DecodeStringInt32 decodes string int32 from json.
func DecodeStringInt64 ¶ added in v0.29.0
DecodeStringInt64 decodes string int64 from json.
func DecodeStringUnixMicro ¶ added in v0.46.1
DecodeStringUnixMicro decodes unix-micro from json string.
func DecodeStringUnixMilli ¶ added in v0.46.1
DecodeStringUnixMilli decodes unix-milli from json string.
func DecodeStringUnixNano ¶ added in v0.46.1
DecodeStringUnixNano decodes unix-nano from json string.
func DecodeStringUnixSeconds ¶ added in v0.46.1
DecodeStringUnixSeconds decodes unix-seconds from json string.
func DecodeTime ¶
DecodeTime decodes time from json.
func DecodeUUID ¶
DecodeUUID decodes UUID from json.
func DecodeUnixMicro ¶ added in v0.30.0
DecodeUnixMicro decodes unix-micro from json string.
func DecodeUnixMilli ¶ added in v0.30.0
DecodeUnixMilli decodes unix-milli from json string.
func DecodeUnixNano ¶ added in v0.30.0
DecodeUnixNano decodes unix-nano from json string.
func DecodeUnixSeconds ¶ added in v0.30.0
DecodeUnixSeconds decodes unix-seconds from json string.
func EncodeDateTime ¶
EncodeDateTime encodes date-time to json.
func EncodeDuration ¶
EncodeDuration encodes duration to json.
func EncodeStringInt32 ¶ added in v0.29.0
EncodeStringInt32 encodes string int32 to json.
func EncodeStringInt64 ¶ added in v0.29.0
EncodeStringInt64 encodes string int64 to json.
func EncodeStringUnixMicro ¶ added in v0.46.1
EncodeStringUnixMicro encodes unix-micro to json string.
func EncodeStringUnixMilli ¶ added in v0.46.1
EncodeStringUnixMilli encodes unix-milli to json string.
func EncodeStringUnixNano ¶ added in v0.46.1
EncodeStringUnixNano encodes unix-nano to json string.
func EncodeStringUnixSeconds ¶ added in v0.46.1
EncodeStringUnixSeconds encodes unix-seconds to json string.
func EncodeUnixMicro ¶ added in v0.30.0
EncodeUnixMicro encodes unix-micro to json string.
func EncodeUnixMilli ¶ added in v0.30.0
EncodeUnixMilli encodes unix-milli to json string.
func EncodeUnixNano ¶ added in v0.30.0
EncodeUnixNano encodes unix-nano to json string.
func EncodeUnixSeconds ¶ added in v0.30.0
EncodeUnixSeconds encodes unix-seconds to json string.
Types ¶
type Settable ¶
type Settable interface {
IsSet() bool
}
Settable value can be set (present) or unset (i.e. not provided or undefined).
type Unmarshaler ¶
Unmarshaler implements json reading.