json

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingTagError = MissingTag{}
	MissingTagType  = reflect.TypeOf(MissingTagError)
)

Functions

func Trim

func Trim(b []byte) (s string)

Types

type MissingTag

type MissingTag struct {
	Payloads Payloads
	Tag      string
}

func (MissingTag) Error

func (m MissingTag) Error() (s string)

func (MissingTag) Is

func (m MissingTag) Is(err error) (b bool)

type NoMatchingTag

type NoMatchingTag struct {
	Payloads Payloads
	Tags     []string
}

func (NoMatchingTag) Error

func (n NoMatchingTag) Error() (s string)

type Payloads

type Payloads map[string]json.RawMessage

func UnmarshalPayloads

func UnmarshalPayloads(b []byte) (Payloads, error)

func (Payloads) ForEach

func (p Payloads) ForEach(fn func(string, RawMsg) error) error

func (Payloads) Get

func (p Payloads) Get(tag string) (raw RawMsg, ok bool)

func (Payloads) HasTag

func (p Payloads) HasTag(tag string) (b bool)

func (Payloads) MissingTag

func (p Payloads) MissingTag(tag string) (err error)

func (Payloads) MustHaveTag

func (p Payloads) MustHaveTag(tag string) (msg json.RawMessage, err error)

func (Payloads) NoMatchingTag

func (p Payloads) NoMatchingTag(tags []string) (err error)

func (Payloads) Unmarshal

func (p Payloads) Unmarshal(tag string, v interface{}) (err error)

func (Payloads) UnmarshalIf

func (p Payloads) UnmarshalIf(tag string, v interface{}) (err error)

type RawMsg

type RawMsg json.RawMessage

func (*RawMsg) AsStdRaw

func (r *RawMsg) AsStdRaw() (rm *json.RawMessage)

func (RawMsg) Bytes

func (r RawMsg) Bytes() (b []byte)

func (*RawMsg) MarshalJSON

func (r *RawMsg) MarshalJSON() (data []byte, err error)

func (RawMsg) String

func (r RawMsg) String() (s string)

func (RawMsg) Strip

func (r RawMsg) Strip() (s string)

func (RawMsg) UnmarshalInto

func (r RawMsg) UnmarshalInto(v interface{}) (err error)

func (*RawMsg) UnmarshalJSON

func (r *RawMsg) UnmarshalJSON(data []byte) (err error)

type UnmarshalFn

type UnmarshalFn func(RawMsg) error

type UnmarshalMap

type UnmarshalMap map[string]UnmarshalFn

func (UnmarshalMap) Keys

func (um UnmarshalMap) Keys() (s []string)

func (UnmarshalMap) Unmarshal

func (um UnmarshalMap) Unmarshal(pl Payloads) (err error)

Jump to

Keyboard shortcuts

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