unpack

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTag      = errors.New(`unpack tag must have form "", "<value>", ",skip", "<value>,skip"`)
	ErrSkip     = errors.New("unpack skip tag can only appear once")
	ErrNeedJSON = errors.New("unpack tag cannot appear without a JSON tag")
)

Functions

This section is empty.

Types

type Reflector

type Reflector map[string]map[string]reflect.Type

func New

func New(templates ...interface{}) Reflector

func (Reflector) Add

func (r Reflector) Add(template interface{}) Reflector

func (Reflector) AddAs

func (r Reflector) AddAs(template interface{}, as string) Reflector

AddAs is like Add but as overrides any name stored under the "unpack" key in template's field tags.

func (Reflector) Unmarshal

func (r Reflector) Unmarshal(b []byte) (interface{}, error)

func (Reflector) UnmarshalObject

func (r Reflector) UnmarshalObject(v interface{}) (interface{}, error)

func (Reflector) UnmarshalString

func (r Reflector) UnmarshalString(s string) (interface{}, error)

Jump to

Keyboard shortcuts

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