json

package
v0.10.11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTagName = "default"

	FormatAttribute     = "format"
	IgnoreCaseFormatter = "ignorecaseformatter"

	ValueAttribute    = "value"
	NullableAttribute = "nullable"
	NameAttribute     = "name"
	RequiredAttribute = "required"
	Embedded          = "embedded"
)
View Source
const (
	TagName  = "json"
	XTagName = "jsonx"
)

Variables

This section is empty.

Functions

func AsPtr

func AsPtr(dest interface{}, rType reflect.Type) unsafe.Pointer

func NewInt8Marshaller

func NewInt8Marshaller(tag *format.Tag) *int8Marshaller

func ResetCache

func ResetCache()

Types

type BytesPtrSlice

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

func (*BytesPtrSlice) UnmarshalJSONArray

func (b *BytesPtrSlice) UnmarshalJSONArray(d *gojay.Decoder) error

type BytesSlice

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

func (*BytesSlice) UnmarshalJSONArray

func (b *BytesSlice) UnmarshalJSONArray(d *gojay.Decoder) error

type DefaultTag

type DefaultTag struct {
	Format              string
	Name                string
	IgnoreCaseFormatter bool
	Value               string
	Nullable            *bool
	Required            *bool
	Embedded            bool
	// contains filtered or unexported fields
}

func NewDefaultTag

func NewDefaultTag(field reflect.StructField) (*DefaultTag, error)

func (*DefaultTag) Init

func (t *DefaultTag) Init(field reflect.StructField) error

func (*DefaultTag) IsNullable

func (t *DefaultTag) IsNullable() bool

func (*DefaultTag) IsRequired

func (t *DefaultTag) IsRequired() bool

type Error added in v0.9.8

type Error struct {
	Path string
	Err  error
}

Error represents a json unmarshal error

func NewError added in v0.9.8

func NewError(path string, err error) *Error

func (*Error) Error added in v0.9.8

func (e *Error) Error() string

type Filter

type Filter map[string]bool

func NewFilter

func NewFilter(fields ...string) Filter

type FilterEntry

type FilterEntry struct {
	Path   string
	Fields []string
}

type Filters

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

func NewFilters

func NewFilters(filterable ...*FilterEntry) *Filters

type MarshalInterceptor

type MarshalInterceptor func() ([]byte, error)

type MarshalerInterceptors

type MarshalerInterceptors map[string]MarshalInterceptor

type MarshallSession

type MarshallSession struct {
	Filters *Filters
	Options []interface{}
	*bytes.Buffer
	Interceptors MarshalerInterceptors
}

type Marshaller

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

func New

func New(config *config.IOConfig) *Marshaller

func (*Marshaller) Marshal

func (j *Marshaller) Marshal(value interface{}, options ...interface{}) ([]byte, error)

func (*Marshaller) Unmarshal

func (j *Marshaller) Unmarshal(data []byte, dest interface{}, options ...interface{}) error

type Option

type Option interface{}

type Options

type Options []Option

func (Options) FormatTag

func (o Options) FormatTag() *format.Tag

func (Options) Tag

func (o Options) Tag() *Tag

type Tag

type Tag struct {
	FieldName string
	OmitEmpty bool
	Transient bool
}

func Parse

func Parse(tagValue string) *Tag

type UnmarshalInterceptor

type UnmarshalInterceptor func(dst interface{}, decoder *gojay.Decoder, options ...interface{}) error

type UnmarshalSession

type UnmarshalSession struct {
	PathMarshaller UnmarshalerInterceptors
	Options        []interface{}
}

type UnmarshalerInterceptors

type UnmarshalerInterceptors map[string]UnmarshalInterceptor

type UnmarshalerInto

type UnmarshalerInto interface {
	UnmarshalJSONWithOptions(dst interface{}, decoder *gojay.Decoder, options ...interface{}) error
}

type XTag

type XTag struct {
	Tag
	Inline bool
}

func ParseXTag

func ParseXTag(jsonTag, customTag string) *XTag

Jump to

Keyboard shortcuts

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