Documentation ¶
Index ¶
- type Bucket
- func (b *Bucket) CreateBucket(key []byte) (walletdb.ReadWriteBucket, error)
- func (b *Bucket) CreateBucketIfNotExists(key []byte) (walletdb.ReadWriteBucket, error)
- func (b *Bucket) Delete(key []byte) error
- func (b *Bucket) DeleteNestedBucket(key []byte) error
- func (b *Bucket) ForEach(fn func(k, v []byte) error) error
- func (b *Bucket) Get(key []byte) []byte
- func (b *Bucket) KeyN() int
- func (b *Bucket) NestedReadBucket(key []byte) walletdb.ReadBucket
- func (b *Bucket) NestedReadWriteBucket(key []byte) walletdb.ReadWriteBucket
- func (b *Bucket) Put(key, value []byte) error
- func (b *Bucket) ReadCursor() walletdb.ReadCursor
- func (b *Bucket) ReadWriteCursor() walletdb.ReadWriteCursor
- type Cursor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is an internal type used to represent a collection of key/value pairs and implements the walletdb Bucket interfaces.
func (*Bucket) CreateBucket ¶
func (b *Bucket) CreateBucket(key []byte) (walletdb.ReadWriteBucket, error)
CreateBucket creates and returns a new nested bucket with the given key. Errors with code Exist if the bucket already exists, and Invalid if the key is empty or otherwise invalid for the driver.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) CreateBucketIfNotExists ¶
func (b *Bucket) CreateBucketIfNotExists(key []byte) (walletdb.ReadWriteBucket, error)
CreateBucketIfNotExists creates and returns a new nested bucket with the given key if it does not already exist. Errors with code Invalid if the key is empty or otherwise invalid for the driver.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) Delete ¶
Delete removes the specified key from the bucket. Deleting a key that does not exist does not return an error.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) DeleteNestedBucket ¶
DeleteNestedBucket removes a nested bucket with the given key.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) ForEach ¶
ForEach invokes the passed function with every key/value pair in the bucket. This includes nested buckets, in which case the value is nil, but it does not include the key/value pairs within those nested buckets.
NOTE: The values returned by this function are only valid during a transaction. Attempting to access them after a transaction has ended will likely result in an access violation.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) Get ¶
Get returns the value for the given key. Returns nil if the key does not exist in this bucket (or nested buckets).
NOTE: The value returned by this function is only valid during a transaction. Attempting to access it after a transaction has ended will likely result in an access violation.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) KeyN ¶
KeyN returns the number of keys and value pairs inside a bucket.
This function is part of the walletdb.ReadBucket interface implementation.
func (*Bucket) NestedReadBucket ¶
func (b *Bucket) NestedReadBucket(key []byte) walletdb.ReadBucket
func (*Bucket) NestedReadWriteBucket ¶
func (b *Bucket) NestedReadWriteBucket(key []byte) walletdb.ReadWriteBucket
NestedReadWriteBucket retrieves a nested bucket with the given key. Returns nil if the bucket does not exist.
This function is part of the walletdb.ReadWriteBucket interface implementation.
func (*Bucket) Put ¶
Put saves the specified key/value pair to the bucket. Keys that do not already exist are added and keys that already exist are overwritten.
This function is part of the walletdb.Bucket interface implementation.
func (*Bucket) ReadCursor ¶
func (b *Bucket) ReadCursor() walletdb.ReadCursor
func (*Bucket) ReadWriteCursor ¶
func (b *Bucket) ReadWriteCursor() walletdb.ReadWriteCursor
ReadWriteCursor returns a new cursor, allowing for iteration over the bucket's key/value pairs and nested buckets in forward or backward order.
This function is part of the walletdb.Bucket interface implementation.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents a cursor over key/value pairs and nested buckets of a bucket.
Note that open cursors are not tracked on bucket changes and any modifications to the bucket, with the exception of cursor.Delete, invalidate the cursor. After invalidation, the cursor must be repositioned, or the keys and values returned may be unpredictable.
func (*Cursor) Close ¶
func (c *Cursor) Close()
Close the cursor
This function is part of the walletdb.Cursor interface implementation.
func (*Cursor) Delete ¶
Delete removes the current key/value pair the cursor is at without invalidating the cursor.
This function is part of the walletdb.Cursor interface implementation.
func (*Cursor) First ¶
First positions the cursor at the first key/value pair and returns the pair.
This function is part of the walletdb.Cursor interface implementation.
func (*Cursor) Last ¶
Last positions the cursor at the last key/value pair and returns the pair.
This function is part of the walletdb.Cursor interface implementation.
func (*Cursor) Next ¶
Next moves the cursor one key/value pair forward and returns the new pair.
This function is part of the walletdb.Cursor interface implementation.