json

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 7 Imported by: 74

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 net.IP, err error)

DecodeIP decodes net.IP.

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.Writer, v time.Time)

func EncodeDateTime

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

func EncodeDuration

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

func EncodeIP

func EncodeIP(s *jx.Writer, v net.IP)

EncodeIP encodes net.IP.

func EncodeTime

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

func EncodeURI

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

EncodeURI encodes url.URL to json.

func EncodeUUID

func EncodeUUID(s *jx.Writer, 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.Writer)
}

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