Documentation
¶
Index ¶
- Variables
- type BoltDB
- func (db *BoltDB) DbAdd(table string, key string, value interface{}) (err error)
- func (db *BoltDB) DbClose() error
- func (db *BoltDB) DbDelete(table string, key string) (err error)
- func (db *BoltDB) DbGet(table string, key string, dbTable DbTable) (interface{}, error)
- func (db *BoltDB) DbGetAll(table string, dbTable DbTable) (elements []interface{}, err error)
- func (db *BoltDB) DbInit(dbDir, dbFile string) error
- func (db *BoltDB) DbTableRebuild(table DbTable) error
- func (db *BoltDB) DbTablesInit(tables []string) (err error)
- type DbProvider
- type DbTable
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger = clogger.CiaoLog(clogger.CiaoNullLogger{})
Logger is a global variable exported to be set by the package importing database package, in order to let it decide which logger it wants to use.
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶
BoltDB database structure
func NewBoltDBProvider ¶
func NewBoltDBProvider() *BoltDB
NewBoltDBProvider returns a bolt based database that conforms to the DBProvider interface
func (*BoltDB) DbTableRebuild ¶
DbTableRebuild builds bolt table into memory
func (*BoltDB) DbTablesInit ¶
DbTablesInit initializes list of tables in Bolt
type DbProvider ¶
type DbProvider interface { // Initializes the Database DbInit(dbDir, dbFile string) error // Closes the database DbClose() error // Creates the tables if the tables do not already exist in the database DbTablesInit(tables []string) error // Populates the in-memory table from the database DbTableRebuild(table DbTable) error // Adds the key/value pair to the table DbAdd(table string, key string, value interface{}) error //Deletes the key/value pair from the table DbDelete(table string, key string) error //Retrives the value corresponding to the key from the table DbGet(table string, key string, dbTable DbTable) (interface{}, error) //Retrieves all values from a table DbGetAll(table string, dbTable DbTable) ([]interface{}, error) }
DbProvider represents a persistent database provider
type DbTable ¶
type DbTable interface { // Creates the backing map NewTable() // Name of the table as stored in the database Name() string // Allocates and returns a single value in the table NewElement() interface{} // Add an value to the in memory table Add(k string, v interface{}) error }
DbTable defines basic table operations
Click to show internal directories.
Click to hide internal directories.