proxy.golang.org : github.com/rusriver/configdb
----------------------------------------------------------------------------- THIS IS UNABRIDGED DOCUMENTATION, PLEASE SEE THE README.md in the project root for more details. ----------------------------------------------------------------------------- package configdb provides convenient access methods to configuration stored as JSON or YAML. Let's start with a simple YAML file config.yml: We can parse it using ParseYaml(), which will return a *Config instance on success: An equivalent JSON configuration could be built using ParseJson(): From now, we can retrieve configuration values using a path in dotted notation: Besides String(), other types can be fetched directly: Bool(), Float64(), Int(), Map() and List(). All these methods will issue an error if the path doesn't exist, or the value doesn't match or can't be converted to the requested type. A nested configuration can be fetched using DotP(). Here we get a new *Config instance with a subset of the configuration: Then the inner values are fetched relatively to the subset: For lists, the dotted path must use an index to refer to a specific value. To retrieve the information from a user stored in the configuration above:
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/rusriver/configdb
License: MIT
Latest release: 24 days ago
Namespace: github.com/rusriver
Stars: 1 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 24 days ago