json

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTagName    = "default"
	FormatAttribute   = "format"
	ValueAttribute    = "value"
	NullableAttribute = "nullable"
	RequiredAttribute = "required"
)
View Source
const TagName = "json"

Variables

This section is empty.

Functions

func GetXType added in v0.2.11

func GetXType(rType reflect.Type) *xunsafe.Type

func ResetCache added in v0.2.11

func ResetCache()

Types

type BufferPool

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

func (*BufferPool) Get

func (p *BufferPool) Get() *bytes.Buffer

func (*BufferPool) Put

func (p *BufferPool) Put(buffer *bytes.Buffer)

type DefaultTag

type DefaultTag struct {
	Format   string
	Value    string
	Nullable *bool
	Required *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 added in v0.2.1

func (t *DefaultTag) IsNullable() bool

func (*DefaultTag) IsRequired added in v0.2.1

func (t *DefaultTag) IsRequired() bool

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 Marshaller

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

func New

func New(rType reflect.Type, config marshal.Default) (*Marshaller, error)

func (*Marshaller) AsOutputPath added in v0.2.1

func (j *Marshaller) AsOutputPath(fieldPath string) (string, error)

func (*Marshaller) Marshal

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

type Tag

type Tag struct {
	FieldName string
	OmitEmpty bool
}

func Parse

func Parse(tagValue string) *Tag

type TypesPool added in v0.2.11

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

Jump to

Keyboard shortcuts

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