Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIncompatStruct = errors.New("Incompatible struct")
View Source
var IgnoreIncompatStruct bool = true
Ignore incompatible structs during copy (default behavior)
An example scenario is where you have a map of hybrid datatypes to be copied to a map of singular struct:
e.g. src_map = { "list": [ 1, 2, 3], "struct": { "item1": "STRING" }} dest_map == map[string] struct { Item1 string `json:"item`"` }
In this case dest_map does not have a "list" type so it is incompatible, therefore it is desireable to IgnoreIncompatStruct when CopyOut.
Functions ¶
func CopyOut ¶
func CopyOut(src interface{}, out interface{}) (err error)
Performs a deep-copy of source object to the passed in interface.
If the object is a struct, then the copy is attempted based on the tag of the json tag of the field; the same rules apply per encoding/json. If a field is not available, then a copier skips it.
func CopyOutTagged ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.