apijson

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

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

func MarshalRoot

func MarshalRoot(value interface{}) ([]byte, error)

func RegisterUnion

func RegisterUnion(typ reflect.Type, discriminator string, variants ...UnionVariant)

func Unmarshal

func Unmarshal(raw []byte, to any) error

func UnmarshalRoot

func UnmarshalRoot(raw []byte, to any) error

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

func (Field) IsInvalid

func (j Field) IsInvalid() bool

func (Field) IsMissing

func (j Field) IsMissing() bool

func (Field) IsNull

func (j Field) IsNull() bool

Returns true if the field is explicitly `null` _or_ if it is not present at all (ie, missing). To check if the field's key is present in the JSON with an explicit null value, you must check `f.IsNull() && !f.IsMissing()`.

func (Field) Raw

func (j Field) Raw() string

type UnionVariant

type UnionVariant struct {
	TypeFilter         gjson.Type
	DiscriminatorValue interface{}
	Type               reflect.Type
}

Jump to

Keyboard shortcuts

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