Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSONTag ¶
GetJSONTag takes a field name and json struct tag value and returns the effective name, omitempty setting and an indicator if the field value should be omitted (if the tag value is "-").
name, omitEmpty, omit := GetJSONTag(fieldName, fieldTag)
Examples:
GetJSONTag("Cake", "tuna,omitempty") -> "tuna",true
GetJSONTag("Cake", "") -> "Cake",false
func StringMapToStruct ¶
StringMapToStruct is the inverse of StructToStringMap. If strict is false, some attempts are made to coerce non-json inputs: - bools are checked for natural values (1 or begins with 't') - string slices are invented by splitting the string on commas
Note: bool conversion is non-strict in all cases.
func StringToBool ¶
StringToBool returns true if the value is true looking if numeric and greater than zero if string and starts with t or y
func StructToStringMap ¶
StructToStringMap converts a struct to a map[string]string by creating entries in the map for each field in the struct. String type values are copied as is. Other types are JSON encoded. JSON struct tags are consulted for map key names and ommit behaviour.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
example-redis
module
|
|
|
example1
module
|
|
|
example2
module
|
|
|
example3
module
|