simpleconfig

package
v2.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONToFlatMap

func JSONToFlatMap(rawConfig []byte) (map[string]string, error)

Covert json to string map (keys are json paths to access element, values are element), ie input json = `{ "credentials": { "account_types": [ "admin", "management", "service", "debug" ], "name": "admin" }, "server": { "ip": "192.168.56.101", "port": 1234 }}`, output = map[string]string{"credentials.name":"admin", "credentials.account_types":"admin,management,service,debug", "server.ip":"192.168.56.101", "server.port":"1234"}

Notes and limitations: * Value is always represented as a string. To convert to int, bool or float use proper Go function from strconv module * JSON arrays should contain only simple elements. If array contain other array or map those sub-elements are ignored during parsing (see. jsonScenarios[2])

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL