refl

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNested = sterr.New("when parsing field '%s'")
)

Convert related errors

Functions

func AssertHomogeneity

func AssertHomogeneity(val, sup reflect.Type) error

AssertHomogeneity returns whether struct contains only sup datatype

func Convert

func Convert(scr, dest interface{}, method string) error

Convert converts one value to another by method, method have to be defined for scr and has to have structure func() (dest, error) with value receiver if scr does not implement it but it is struct, its values will be converted instead if possible, scr and dest has to be passed as pointer

func Overwrite

func Overwrite(target, defaults interface{}, onlyZeroValues bool)

Overwrite takes target and default struct, all fields of target that has default value will be overwritten by default struct, this is deep copy only in case of raw values, pointers will point to same values

Types

This section is empty.

Jump to

Keyboard shortcuts

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