Documentation
¶
Index ¶
Constants ¶
View Source
const StorageInterface meta.Interface = "core/Storage@1.0.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlreadyExists ¶
type AlreadyExists struct {
Entity string
}
func (AlreadyExists) Error ¶
func (e AlreadyExists) Error() string
type Cursor ¶
type Cursor interface {
First() (key string, value []byte)
Last() (key string, value []byte)
Next() (key string, value []byte)
Prev() (key string, value []byte)
// Seek moves the cursor to a seek key and returns it,
// If the key does not exist then then next key is used.
// If there are no keys, an empty key is returned
Seek(seek string) (key string, value []byte)
// Delete removes current key-value
Delete() error
// HasNext returns true if next element exists
HasNext() bool
// Free current cursor, close cursor transactions, free used memory etc
Close() error
}
type KeyValue ¶
type KeyValue interface {
// Get retrieves the value for a key.
Get(key string) ([]byte, error)
// Set sets the value for a key.
Set(key string, value []byte) error
// Delete removes a key
Delete(key string) error
// ForEach executes a function for each key/value pair
ForEach(fn func(k string, v []byte) error) error
}
type Storage ¶
type Storage interface {
// CreateBucket creates a new bucket with the given name and returns it.
CreateBucket(name string) (Bucket, error)
// CreateBucketIfNotExists creates a new bucket if it doesn't already exist and returns it.
CreateBucketIfNotExists(name string) (Bucket, error)
// Bucket returns a bucket by name.
Bucket(name string) (Bucket, error)
// DeleteBucket deletes a bucket with the given name.
DeleteBucket(name string) error
// Close current storage: connection to db, file etc
Close() error
}
Click to show internal directories.
Click to hide internal directories.