Ocean: github.com/SommerEngineering/Ocean/ConfigurationDB Index | Files

package ConfigurationDB

import "github.com/SommerEngineering/Ocean/ConfigurationDB"

This package provides the configuration database access: Ocean uses MongoDB as database! The configuration is represented as name value pairs. Both, the name and the value, are strings. If you need numbers for the configuration, you have to convert these strings in to numbers afterwards. Use the Read() function to read a specific configuration value.

To provide own application configurations, use the function CheckSingleConfigurationPresentsAndAddIfMissing() to ensure, that at least a default value is present in the database. Collect all these function calls inside a init() function somewhere at your application.

Index

Package Files

CheckConfiguration.go ConnectDatabase.go Doc.go Init.go Read.go ReadAll.go Scheme.go Shutdown.go UpdateValue.go Variables.go Write.go

func CheckSingleConfigurationPresentsAndAddIfMissing Uses

func CheckSingleConfigurationPresentsAndAddIfMissing(name, value string)

Use this function to ensure that the database contains at least a default value for the configuration.

func Read Uses

func Read(name string) (value string)

This function reads the current configuration value.

func ReadAll Uses

func ReadAll() (values []ConfigurationDBEntry)

This function reads all configuration values e.g. for the admin's configuration web interface.

func UpdateValue Uses

func UpdateValue(name string, configuration ConfigurationDBEntry)

This function updates a configuration value e.g. from the admin's configuration web interface.

func Write Uses

func Write(name, value string)

This function writes the configuration value.

type ConfigurationDBEntry Uses

type ConfigurationDBEntry struct {
    Name  string `bson:"Name"`
    Value string `bson:"Value"`
}

The type for a configuration entry.

type ShutdownFunction Uses

type ShutdownFunction struct {
}

The type for the shutdown function.

func (ShutdownFunction) Shutdown Uses

func (a ShutdownFunction) Shutdown()

If the Ocean server is shutting down, this function is called to close the database.

Package ConfigurationDB imports 8 packages (graph) and is imported by 11 packages. Updated 2017-02-16. Refresh now. Tools for package owners.