Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Imap_to_struct ¶
Accepts a map of [string]interface{}, and attempts to populate the fields in the user struct (pointer) from the values in the map. Only the fields in the struct which are tagged with the given tag ID are are affected. If the tag ID is '_' (underbar), then all fields which are external/exported are potentially affected. The struct tag takes the format:
tag_id:"tagstr"
where tagstr is used as the field name in the map to look up. If tagstr is given as an '_' (underbar) character, then the structure field name is used. Names are case sensitive.
This function supports transferring the simple types (bool, int, float, etc.) and pointers to those types from the map. It also supports structures, anonymous structures and pointers to structures, slices and maps.
func Map_to_struct ¶
Accepts a map of [string]string, or [string]interface{}, and attempts to populate the fields in the user struct (pointer) from the values in the map. Only the fields in the struct which are tagged with the given tag ID are given are affected. If the tag ID is '_' (underbar), then all fields which are external/exported are potentially affected. The struct tag takes the format:
tag_id:"tagstr"
where tagstr is used as the field name in the map to look up. If tagstr is given as an '_' (underbar) character, then the structure field name is used. Names are case sensitive.
This function supports transferring the simple types (bool, int, float, etc.) and pointers to those types from the map. It also supports structures, anonymous structures and pointers to structures, slices and maps.
func Struct_to_map ¶
Accept a structure and build a map from its values. The map is [string]string, and the keys are taken from fields tagged with tags that match the tag_id string passed in.
If the tag id is map, then a tag might be `map:"xyz"` where xyz is used as the name in the map, or `map:"_"` where the structure field name is used in the map. If the tag id "_" is passed in, then all fields in the structure are captured.
This function will capture all simple fields (int, bool, float, etc.) and structures, anonynmous structures and pointers to structures. It will _NOT_ capture arrays or maps.
Types ¶
This section is empty.