Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDefaults(a, b interface{})
- func CopyFrom(a, b interface{})
- func FieldName(name string) string
- func FlattenMap(a map[string]interface{}) map[string]interface{}
- func IsEmpty(v reflect.Value) bool
- func IsZero(src interface{}) bool
- func Lookup(i interface{}, path string) (reflect.Value, error)
- func Merge(dst interface{}, mp map[string]interface{}, opts ...Option) error
- func StructFieldByName(src interface{}, tkey string) (interface{}, error)
- func StructFieldByTag(src interface{}, tkey string, tval string) (interface{}, error)
- func StructURLValues(src interface{}, pref string, tags []string) (url.Values, error)
- func URLMap(query string) (map[string]interface{}, error)
- func Zero(src interface{}) (interface{}, error)
- type Option
- type Options
- type StructField
Constants ¶
View Source
const ( SplitToken = "." IndexCloseChar = "]" IndexOpenChar = "[" )
Variables ¶
View Source
var ( ErrMalformedIndex = errors.New("Malformed index key") ErrInvalidIndexUsage = errors.New("Invalid index key usage") ErrKeyNotFound = errors.New("Unable to find the key") ErrBadJSONPath = errors.New("Bad path: must start with $ and have more then 2 chars") )
View Source
var ( ErrInvalidStruct = errors.New("invalid struct specified") ErrInvalidValue = errors.New("invalid value specified") ErrNotFound = errors.New("struct field not found") )
View Source
var ErrInvalidParam = errors.New("invalid url query param provided")
ErrInvalidParam specifies invalid url query params
Functions ¶
func CopyDefaults ¶ added in v3.1.4
func CopyDefaults(a, b interface{})
CopyDefaults for a from b a and b should be pointers to the same kind of struct
func CopyFrom ¶ added in v3.1.4
func CopyFrom(a, b interface{})
CopyFrom sets the public members of a from b a and b should be pointers to structs a can be a different type from b Only the Fields which have the same name and assignable type on a and b will be set.
func FlattenMap ¶ added in v3.2.8
FlattenMap expand key.subkey to nested map
func IsZero ¶ added in v3.2.24
func IsZero(src interface{}) bool
IsZero returns true if struct is zero (not have any defined values)
func StructFieldByName ¶ added in v3.3.18
func StructFieldByTag ¶ added in v3.3.18
func StructURLValues ¶ added in v3.3.10
Types ¶
type StructField ¶ added in v3.3.22
type StructField struct { Field reflect.StructField Value reflect.Value }
func StructFields ¶ added in v3.1.4
func StructFields(src interface{}) ([]StructField, error)
StructFields returns slice of struct fields
Click to show internal directories.
Click to hide internal directories.