reflect

package
v3.2.19 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 specifies invalid struct error
	ErrInvalidStruct = errors.New("invalid struct specified")
	// ErrInvalidParam specifies invalid url query params
	ErrInvalidParam = errors.New("invalid url query param provided")
)

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

func FlattenMap(a map[string]interface{}) map[string]interface{}

FlattenMap expand key.subkey to nested map

func IsEmpty

func IsEmpty(v reflect.Value) bool

IsEmpty returns true if value empty

func Lookup added in v3.2.12

func Lookup(i interface{}, path string) (reflect.Value, error)

func MergeMap added in v3.2.7

func MergeMap(a interface{}, b map[string]interface{}) error

MergeMap merges maps

func StructFields added in v3.1.4

func StructFields(src interface{}) ([]reflect.StructField, error)

StructFields returns slice of struct fields

func URLMap added in v3.2.8

func URLMap(query string) (map[string]interface{}, error)

URLMap returns map of url query params

func Zero

func Zero(src interface{}) (interface{}, error)

Zero creates new zero interface

Types

This section is empty.

Jump to

Keyboard shortcuts

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