Documentation ¶
Index ¶
- func Delete(key string) error
- func Find(prefix string) ([]string, error)
- func Get(key string, valPtr interface{}) error
- func Init(conf string) error
- func IsNotFoudError(err error) bool
- func Set(key string, val interface{}) error
- func SetWithTTL(key string, val interface{}, d time.Duration) error
- type Database
- type FileDB
- func (db *FileDB) Delete(key string) error
- func (db *FileDB) Find(prefix string) ([]string, error)
- func (db *FileDB) Get(key string, valPtr interface{}) error
- func (db *FileDB) Init() error
- func (db *FileDB) Set(key string, val interface{}) error
- func (db *FileDB) SetWithTTL(key string, val interface{}, d time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFoudError ¶
Types ¶
type Database ¶
type Database interface { Init() error Get(string, interface{}) error Find(string) ([]string, error) Set(string, interface{}) error SetWithTTL(string, interface{}, time.Duration) error Delete(string) error }
Database is an interface for a simple key value store intended to be backed by the appropriate database engine for the intended use case ex:
- redis if running on a server
- bolt if running in an embeded environment (mobile, drone, ...)
var DB Database
DB holds the global database instance
type FileDB ¶
type FileDB struct {
// contains filtered or unexported fields
}
FileDB is a simple bolt based persistent key value store
Click to show internal directories.
Click to hide internal directories.