Add Modify() and GetItem() to interface and badger store
This commit is contained in:
@@ -8,7 +8,12 @@ type Store interface {
|
||||
Set(key string, val interface{}) error
|
||||
// Get places a value at a key into val
|
||||
Get(key string, val interface{}) error
|
||||
Delete(key string) error
|
||||
// GetItem gets an item from the store
|
||||
GetItem(string) (*Item, error)
|
||||
// Delete deletes a value from the store
|
||||
Delete(string) error
|
||||
// Modify allows editing of a value in the store
|
||||
Modify(string, ModifyFunc) error
|
||||
// Bucket returns a bucket with the specified name
|
||||
Bucket(name string) Bucket
|
||||
// Iter returns an iterator
|
||||
@@ -23,11 +28,18 @@ type Bucket interface {
|
||||
Set(string, interface{}) error
|
||||
// Get places a value at a key in the bucket into val
|
||||
Get(string, interface{}) error
|
||||
// GetItem gets an item from the store
|
||||
GetItem(string) (*Item, error)
|
||||
// Delete deletes a value from the bucket
|
||||
Delete(key string) error
|
||||
// Modify allows editing of a value in the bucket
|
||||
Modify(string, ModifyFunc) error
|
||||
// Iter returns an iterator for the bucket
|
||||
Iter() Iter
|
||||
}
|
||||
|
||||
type ModifyFunc func(*Item) (interface{}, error)
|
||||
|
||||
// Item represents an iterator item
|
||||
type Item struct {
|
||||
Key string
|
||||
|
||||
Reference in New Issue
Block a user