Documentation ¶
Index ¶
Constants ¶
const ( Version = "0.0.1" Name = "plethora" )
const BucketName = "config"
Variables ¶
This section is empty.
Functions ¶
func Database ¶
Database returns the bolt database associated with the name given. If Database is called multiple times with the same name it will return the same *bolt.DB unless it was previously closed.
func DatabasePath ¶
DatabasePath returns the filepath to the database associated with the name given. This function can be used to use an alternate file-based database in code.
func Init ¶
func Init() error
Init initializes the config package, this should be called before any other functions are used in this package.
func TestConfiguration ¶
func TestConfiguration() func()
TestConfiguration sets up temporary locations for configuration files, this should only be called in testing code.
The returned function should be called to cleanup any files that are created.
func UpdateLocation ¶
UpdateLocation updates the database location in the dbloc file, this does not move any existing databases around.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a helper for configuration storage and retrieval.
func OpenConfig ¶
OpenConfig returns the Config associated with the name given.
func (Config) Load ¶
Load retrieves the value stored under the key and unmarshals it into the value given. If the key does not exist or is empty this returns err == nil.
Load uses an encoding to load the value, any fields in the value type need to be exported to load properly.
func (Config) Store ¶
Store stores the value given under the key passed. Store encodes the value given before storing it. The encoding used can be found in the Config documentation.
Store uses an encoding to store the value given, this means that any fields in the value type need to be exported to be saved.