datastores

package
v1.0.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDB

type BoltDB struct {
	Database string
	User     string
	Password string
}

The BoltDB database information

func (BoltDB) Get

func (store BoltDB) Get(configItem *ConfigItem) (ConfigItem, error)

func (BoltDB) GetAll added in v1.0.20

func (store BoltDB) GetAll(application string) ([]ConfigItem, error)

func (BoltDB) InitStore

func (store BoltDB) InitStore(overwrite bool) error

func (BoltDB) Remove added in v1.0.28

func (store BoltDB) Remove(configItem *ConfigItem) error

func (BoltDB) Set

func (store BoltDB) Set(configItem *ConfigItem) error

type ConfigItem

type ConfigItem struct {
	Id          int64     `sql:"id" json:"id"`
	Application string    `sql:"application" json:"application"`
	Machine     string    `sql:"machine" json:"machine"`
	Name        string    `sql:"name" json:"name"`
	Value       string    `sql:"value" json:"value"`
	LastUpdated time.Time `sql:"updated" json:"updated"`
}

ConfigItem represents a configuration item

type ConfigResponse added in v1.0.25

type ConfigResponse struct {
	Status  int          `json:"status"`
	Message string       `json:"message"`
	Data    []ConfigItem `json:"data"`
}

type ConfigService

type ConfigService interface {

	//	Initialize the store (create the DDL if necessary)
	InitStore(overwrite bool) error

	//	Create / update a config item
	Set(c *ConfigItem) error

	//	Get a specific config item
	Get(c *ConfigItem) (ConfigItem, error)

	//	Get all config items for the given application
	GetAll(application string) ([]ConfigItem, error)

	//	Remove a config item
	Remove(c *ConfigItem) error
}

ConfigService encapsulates account (user) based operations This allows us to create a testable service layer. See https://github.com/tonyhb/tonyhb.com/blob/master/posts/Building%20a%20testable%20Golang%20database%20layer.md for more information

func GetConfigDatastore added in v1.0.24

func GetConfigDatastore() ConfigService

Get the currently configured datastore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL