Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Some default converter types for a nicer syntax String string = "" Bool bool = false Int int = 0 Float32 float32 = 0 Float64 float64 = 0 )
These flags define options for tag handling
Variables ¶
Functions ¶
func Copy ¶
func Copy(toValue interface{}, fromValue interface{}) (err error)
Copy copy things. ignore empty value in struct
func CopyWithOption ¶
CopyWithOption copy with option
func StringToLower ¶ added in v0.3.6
Types ¶
type Option ¶
type Option struct { // setting this value to true will ignore copying zero values of all the fields, including bools, as well as a // struct having all it's fields set to their zero values respectively (see IsZero() in reflect/value.go) IgnoreEmpty bool DeepCopy bool // setting struct to map will set the map key UpperCase or LowerCase UpperCase bool IgnoreField []string // LowerCase bool TimeFormat string // time and int64 copier :unix, unixmill // Support user setting copier tag flag.The default TagFlag is copier,and TagDelimiter is a comma(","). // For example: `copier:"Name,must,nopanic"` is the default format. Now you can write `num:"Name;must;nopanic;"` by setting // Option{TagFlag: "num",TagDelimiter: ";"} TagFlag string TagDelimiter string Converters []TypeConverter }
Option sets copy options
type TypeConverter ¶ added in v0.3.5
type TypeConverter struct { SrcType interface{} DstType interface{} Fn func(src interface{}) (dst interface{}, err error) }
Click to show internal directories.
Click to hide internal directories.