json

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

This section is empty.

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

Jump to

Keyboard shortcuts

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