Go tableize the given map by recursively walking the map and normalizing its keys to produce a flat SQL-friendly map.
$ go get github.com/segmentio/go-tableize/cmd/tableize
$ echo '{"user": { "id": 1 }}' | tableize
{ "user_id": 1 }
event := map[string]interface{}{
"name": map[string]interface{}{
"first name ": "tobi",
"last-name": "holowaychuk",
},
"species": "ferret",
}
flat := Tableize(event)
assert(t, flat["name_first_name"] == "tobi")
assert(t, flat["name_last_name"] == "holowaychuk")
assert(t, flat["species"] == "ferret")
Version | Tag | Published |
---|---|---|
v1.0.1-0.20210621150708-ac924d5a164c | 1yr ago | |
v1.0.1-0.20210621124629-2255500bfcfb | 1yr ago | |
v1.0.1-0.20190128170149-fc24ad53f554 | 1yr ago | |
v1.0.1-0.20180313202008-a782d42784c8 | 2yrs ago |