Documentation ¶
Overview ¶
Package store provides a simple and convenient data store interface for plugins to persist data along with a default filed-based leveldb implementation.
Index ¶
- type BytesStorer
- type LevelDB
- func (ldb *LevelDB) Close() (err error)
- func (ldb *LevelDB) Delete(key []byte) (err error)
- func (ldb *LevelDB) DeleteString(key string) (err error)
- func (ldb *LevelDB) Get(key []byte) (value []byte, err error)
- func (ldb *LevelDB) GetString(key string) (value string, err error)
- func (ldb *LevelDB) Put(key []byte, value []byte) (err error)
- func (ldb *LevelDB) PutString(key string, value string) (err error)
- func (ldb *LevelDB) Scan() (entries map[string]string, err error)
- type Scanner
- type StringStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesStorer ¶
type BytesStorer interface { io.Closer Scanner Get(key []byte) (value []byte, err error) Put(key []byte, value []byte) (err error) Delete(key []byte) (err error) }
BytesStorer is implemented by any value that has the Get/Put/Delete/Scan and Closer methods on byte arrays for keys/values.
type LevelDB ¶
type LevelDB struct { Name string // contains filtered or unexported fields }
LevelDB holds a datastore name and its leveldb instance
func NewLevelDB ¶
NewLevelDB instantiates and open a new LevelDB instance backed by a leveldb database. If the leveldb database doesn't exist, one is created
func (*LevelDB) DeleteString ¶
DeleteString deletes an entry for a given key string
type Scanner ¶
Scanner is implemented by any value that has the Scan method returning all key/values as strings.
Since []byte aren't allowed as map keys, we use don't have an equivalent Scanner interface returning the data as bytes. For implementers, it should be easy to convert the []byte values to string with a simple string(value) conversion as strings are immutable arrays of bytes
type StringStorer ¶
type StringStorer interface { io.Closer Scanner GetString(key string) (value string, err error) PutString(key string, value string) (err error) DeleteString(key string) (err error) }
StringStorer is implemented by any value that has the Get/Put/Delete/Scan and Closer methods on string keys/values.
Directories ¶
Path | Synopsis |
---|---|
Package databasedb provides an implementation of github.com/alexandre-normand/slackscot/store's StringStorer interface backed by the Google Cloud Datastore.
|
Package databasedb provides an implementation of github.com/alexandre-normand/slackscot/store's StringStorer interface backed by the Google Cloud Datastore. |