Documentation ΒΆ
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func JSONFileParser ΒΆ
JSONFileParser provides a simple implementation of the Parser type and simply reads in an parses a JSON file given its file path
Types ΒΆ
type Merger ΒΆ
type Merger struct {
ConfigMap map[string]interface{}
}
Merger type has one member being a map which it modifies and queries through its public methods
func (*Merger) Get ΒΆ
Get retrieves parts of the stored config map through a dot seperated path. If the path leads to a final value, this will be returned, if not a map will be returned holding the section pointed to by the path. The path is case sensitive
func (*Merger) Read ΒΆ
Read synchronously reads and parses all provided files using the given parser function into the current config map. Returns an error object containing any errors that occured
func (*Merger) ReadAsync ΒΆ
ReadAsync asynchronously reads and parses all provided files using the given parser function into the current config map. Returns an error object containing any errors that occured.
If you pass multiple files which may override one another, the resulting config map stored in the Merger object will be nondeterministic. Whilst it reads in files asynchronously, this function is blocking as it waits for all files to have been read or attempted to have been read.
type Parser ΒΆ
A Parser is just a function which takes in a string and returns a map, having this as an exposed type allows anyone to create their own Parser function which can be parsed into the Read or ReadAsync functions. Some possible examples are: 1. A parser for a different file type 2. A parser which communicates with an API endpoint to retrieve the map 3. A parser which works over many different file types