Documentation
¶
Index ¶
- Constants
- Variables
- func Btos(b []byte) string
- func Close() error
- func Count() int
- func Delete(key []byte) error
- func Get(key []byte) []byte
- func Iterator(f func([]byte, []byte) bool) error
- func Open(table []byte, paths ...string) error
- func ProjectDir() string
- func Put(key, value []byte) error
- func Register(i Instance)
- func Stob(s string) []byte
- type Instance
- type KV
Constants ¶
View Source
const DefaultTableName = "gkv"
DefaultTableName the default name of table.
Variables ¶
View Source
var ErrTableName = errors.New("illegal table name")
ErrTableName illegal table name error
Functions ¶
func Open ¶
Open creates a new KV driver by table name and storage file path. table is the name of storage. paths are storage file paths.
Types ¶
type KV ¶
type KV interface {
// DB returns the native DB of the adapter.
DB() interface{}
// Close releases all database resources.
Close() error
// Register creates a new storage if it doesn't already exist.
Register([]byte) error
// Put sets the value for a key.
Put([]byte, []byte) error
// Get retrieves the value for a key.
Get([]byte) []byte
// Delete deletes the given key from the database resources.
Delete([]byte) error
// Count returns the total number of all the keys.
Count() int
// Iterator creates an iterator for iterating over all the keys.
Iterator(func([]byte, []byte) bool) error
}
KV short for key-value, interface contains all behaviors for key-value adapter.
Click to show internal directories.
Click to hide internal directories.