Documentation
¶
Overview ¶
Package store defines the Store interface, some common types and some common functions.
Index ¶
Constants ¶
View Source
const ( ConfigTypeDefault = "properties" // default format ConfigTypeJSON = "json" // JSON ConfigTypeYAML = "yaml" // YAML ConfigTypeYML = "yml" // YAML ConfigTypeEnv = "env" // environment )
View Source
const ( ChangeTypeAdded = iota // configuration added ChangeTypeUpdated // configuration updated ChangeTypeDeleted // configuration deleted )
Variables ¶
This section is empty.
Functions ¶
func ConfigType ¶
ConfigType uses file extension as configuration format, such as properties, xml, yml, yaml, json...
- If extension is missing, default is `properties`
- If extension is not supported, error is returned
Types ¶
type ConfigChange ¶
type ConfigChange struct { Type ChangeType Key string // key of the changed configuration }
ConfigChange change of configuration
type ConfigChanges ¶
type ConfigChanges struct { Config ConfigContent Changes []ConfigChange }
ConfigChanges changes of configurations
type ConfigContent ¶
type ConfigContent struct { Type string // configuration format: json, yaml, properties... Content []byte // configuration content }
ConfigContent is the configuration content read from a Store object
type Store ¶
type Store interface { Load() ([]ConfigContent, error) // read configurations Watch(ch chan<- *ConfigChanges) error // watch configuration changes Unwatch() // stop watching }
Store is the interface from which configurations can be read and watched
Directories
¶
Path | Synopsis |
---|---|
Package apollo implements Store for reading and watching configurations from Apollo.
|
Package apollo implements Store for reading and watching configurations from Apollo. |
Package env implements a Store for reading and watching configurations from ENV.
|
Package env implements a Store for reading and watching configurations from ENV. |
Package file implements a Store client for reading and watching configurations from local files.
|
Package file implements a Store client for reading and watching configurations from local files. |
Click to show internal directories.
Click to hide internal directories.