Documentation
¶
Index ¶
- func DeepCopy(src interface{}) interface{}
- func ExtractIntValue(s string, r *regexp.Regexp) (bool, int, error)
- func ExtractStringValue(s string, r *regexp.Regexp) (bool, string, error)
- func ParseBytesByType(b []byte, t reflect.Type) (reflect.Value, error)
- func SetMapValue(src reflect.Value, dst reflect.Value)
- func SetSliceOrArrayValue(src reflect.Value, dst reflect.Value)
- func SimpleMergeTwoValues(src reflect.Value, dst reflect.Value) error
- type MergeValueFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractIntValue ¶
ExtractIntValue extract int value from a string according regexp.
func ExtractStringValue ¶
ExtractStringValue extract string value from a string according regexp.
func ParseBytesByType ¶
ParseBytesByType parse []byte to a value with type t
func SetMapValue ¶
SetMapValue set all key and value from src map to dst map, and the value of same key in the dst map will be overwritten
func SetSliceOrArrayValue ¶
SetSliceOrArrayValue append src slice or array to the end of dst
func SimpleMergeTwoValues ¶
SimpleMergeTwoValues merge two value with same type, which includes 3 cases: 1. slice & array (or its pointer): append src slice to dst 2. map (or its pointer): src map will overwrite dst 3. other (or its pointer): set src by dst since SimpleMergeTwoValues is a "simple" one, there may exist some cases SimpleMergeTwoValues won't support, and a possible one is a struct with a map or slice member, we will not merge its member object. for example, consider src and dst with the same type of
struct newType struct { a []string },
and src is newType{"a":["2"]}, dst is newType{"a":["1"]}, the simple merge result is newType{"a":["2"]}, and not newType{"a":["1","2"]}