Utility package does conversions between Consul KV pairs to Go struct or map[string]interface{}. It also provides several utilities to convert directly: nested map to flatten/kv map or Consul kv pairs, flatten/kv map to Go struct, Kv map to nested map, etc.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
glide.lock
glide.yaml
kvmapstruct.go
kvmapstruct_examples_test.go
kvmapstruct_test.go

README.md

kvmapstruct

Package kvstruct exposes various utility functions to do conversions between: Consul KV pairs and native Go Struct or map[string]interface{}.

It also provides several utilities to convert directly:

  • Nested map to flatten/kv map or Consul kv pairs
  • Flatten/kv map to Go struct
  • Kv map to nested map, etc.

There are some notions that are used in this package.

  • Nested map: classic nested map[string]interface{}.
  • Flatten map: map[string]interface{} represents key/value. It means that no nested map will be value. Value can be a normal type including slice.
  • KV map: map[string]interface{} represents key/value but value can not be slice or map. A slice will be represented by keys suffixed by 0, 1, 2 etc.

This package only supports the following value types: int, bool, string, []int, []bool, []string and map[string]interface{}

Documentation

See the Godoc