json

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 316 modules, 290 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeDate

func DecodeDate(i *jx.Decoder) (v time.Time, err error)

func DecodeDateTime

func DecodeDateTime(i *jx.Decoder) (v time.Time, err error)

func DecodeDuration

func DecodeDuration(i *jx.Decoder) (v time.Duration, err error)

func DecodeIP

func DecodeIP(i *jx.Decoder) (v netip.Addr, err error)

DecodeIP decodes netip.Addr.

func DecodeStringInt32 added in v0.29.0

func DecodeStringInt32(d *jx.Decoder) (v int32, err error)

DecodeStringInt32 decodes string int32 from json.

func DecodeStringInt64 added in v0.29.0

func DecodeStringInt64(d *jx.Decoder) (v int64, err error)

DecodeStringInt64 decodes string int64 from json.

func DecodeTime

func DecodeTime(i *jx.Decoder) (v time.Time, err error)

func DecodeURI

func DecodeURI(i *jx.Decoder) (v url.URL, err error)

DecodeURI decodes url.URL from json.

func DecodeUUID

func DecodeUUID(i *jx.Decoder) (v uuid.UUID, err error)

DecodeUUID decodes UUID from json.

func Encode

func Encode(m Marshaler) []byte

Encode Marshaler to byte slice.

func EncodeDate

func EncodeDate(s *jx.Encoder, v time.Time)

func EncodeDateTime

func EncodeDateTime(s *jx.Encoder, v time.Time)

func EncodeDuration

func EncodeDuration(s *jx.Encoder, v time.Duration)

func EncodeIP

func EncodeIP(s *jx.Encoder, v netip.Addr)

EncodeIP encodes netip.Addr.

func EncodeStringInt32 added in v0.29.0

func EncodeStringInt32(e *jx.Encoder, v int32)

EncodeStringInt32 encodes string int32 to json.

func EncodeStringInt64 added in v0.29.0

func EncodeStringInt64(e *jx.Encoder, v int64)

EncodeStringInt64 encodes string int64 to json.

func EncodeTime

func EncodeTime(s *jx.Encoder, v time.Time)

func EncodeURI

func EncodeURI(s *jx.Encoder, v url.URL)

EncodeURI encodes url.URL to json.

func EncodeUUID

func EncodeUUID(s *jx.Encoder, v uuid.UUID)

EncodeUUID encodes UUID to json.

func Marshal

func Marshal(val interface{}) ([]byte, error)

Marshal value to json.

func Unmarshal

func Unmarshal(data []byte, val interface{}) error

Unmarshal value from json.

Types

type Marshaler

type Marshaler interface {
	Encode(e *jx.Encoder)
}

Marshaler implements json writing.

type Nullable

type Nullable interface {
	IsNil() bool
}

Nullable can be nil (but defined) or not.

type Resettable

type Resettable interface {
	Reset()
}

Resettable value can be unset.

type Settable

type Settable interface {
	IsSet() bool
}

Settable value can be set (present) or unset (i.e. not provided or undefined).

type Unmarshaler

type Unmarshaler interface {
	Decode(d *jx.Decoder) error
}

Unmarshaler implements json reading.

type Value

type Value interface {
	Marshaler
	Unmarshaler
}

Value represents a json value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL