Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrNoRows ¶
IsErrNoRows returns true if the passed error is an sql.ErrNoRows error.
Types ¶
type KeyValueDB ¶
type KeyValueDB struct {
// contains filtered or unexported fields
}
KeyValueDB is an object similar to sql.DB that provides simple methods for create, read, update, and delete functionality on key-value items.
func NewDB ¶
func NewDB(name string) (kv *KeyValueDB, err error)
NewDB initializes a new KeyValueDB database connection.
func (*KeyValueDB) DeleteObject ¶
func (kv *KeyValueDB) DeleteObject(table, id string) (err error)
DeleteObject removes an object from the database.
func (*KeyValueDB) GetObject ¶
func (kv *KeyValueDB) GetObject(table, id string, result interface{}) (err error)
GetObject retrieves and decodes the stored value into result.
func (*KeyValueDB) SetObject ¶
func (kv *KeyValueDB) SetObject(table, id string, value interface{}) error
SetObject creates or updates the key-value pair.
func (*KeyValueDB) Table ¶
func (kv *KeyValueDB) Table(table string) *KeyValueTable
Table returns the KeyValueTable associated with this table name.
type KeyValueTable ¶
type KeyValueTable struct { Table string // contains filtered or unexported fields }
KeyValueTable represents a specific table name of the database.
func (*KeyValueTable) DeleteObject ¶
func (kvt *KeyValueTable) DeleteObject(id string) error
DeleteObject removes an object from the database.
func (*KeyValueTable) GetObject ¶
func (kvt *KeyValueTable) GetObject(id string, result interface{}) error
GetObject retrieves and decodes the stored value into result.
func (*KeyValueTable) SetObject ¶
func (kvt *KeyValueTable) SetObject(id string, value interface{}) error
SetObject creates or updates the key-value pair in this table.