Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayColumn ¶
func ArrayColumn(input []interface{}, key string) []interface{}
ArrayColumn Eg: input:[struct{Name:"a",Age:10},{Name:"b",Age:15}] key:"Name" => ["a","b"] input:[map{"k1":"v1","k2":"v2"},map{"k1":"vv1","k2":"vv2"}] key:"k1" => ["v1","vv1"]
func SliceToMapWithColumnAsKey ¶
func SliceToMapWithColumnAsKey(slice interface{}, key string) map[interface{}]interface{}
SliceToMapWithColumnAsKey converts slice type variable `slice` to `map[interface{}]interface{}` The value of specified column use as the key for returned map. Eg: SliceToMapWithColumnAsKey([{"K1": "v1", "K2": 1}, {"K1": "v2", "K2": 2}], "K1") => {"v1": {"K1": "v1", "K2": 1}, "v2": {"K1": "v2", "K2": 2}} SliceToMapWithColumnAsKey([{"K1": "v1", "K2": 1}, {"K1": "v2", "K2": 2}], "K2") => {1: {"K1": "v1", "K2": 1}, 2: {"K1": "v2", "K2": 2}}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.