kvstore

package
v0.0.0-...-f665cec Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrNoRows

func IsErrNoRows(err error) bool

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.

Jump to

Keyboard shortcuts

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