Documentation ¶
Index ¶
- func DeleteKey(db *bolt.DB, path Path, key []byte) (err error)
- func EnsureNestedBucket(db *bolt.DB, path Path, bucket string) (err error)
- func EnsurePathBuckets(db *bolt.DB, path Path) (err error)
- func GetBucket(tx *bolt.Tx, path Path) (b *bolt.Bucket)
- func GetByteValue(b *bolt.Bucket, key []byte) (valueCopy []byte)
- func GetInt64Value(b *bolt.Bucket, key []byte) (value int64, err error)
- func GetUint64Value(b *bolt.Bucket, key []byte) (value uint64, err error)
- func GetUvarintValue(b *bolt.Bucket, key []byte) (value uint64, err error)
- func GetValueInTx(tx *bolt.Tx, path Path, key []byte) (value []byte)
- func GetVarintValue(b *bolt.Bucket, key []byte) (value int64, err error)
- func IncrementInt64Value(b *bolt.Bucket, key []byte, value int64) (newValue int64, err error)
- func IncrementUint64Value(b *bolt.Bucket, key []byte, value uint64) (newValue uint64, err error)
- func PutBinaryValue(b *bolt.Bucket, key []byte, valueObj encoding.BinaryMarshaler) (err error)
- func PutInt64Value(b *bolt.Bucket, key []byte, value int64) error
- func PutJsonValue(b *bolt.Bucket, key []byte, valueObj interface{}) (err error)
- func PutTextValue(b *bolt.Bucket, key []byte, valueObj encoding.TextMarshaler) (err error)
- func PutUint64Value(b *bolt.Bucket, key []byte, value uint64) (err error)
- func PutUvarintValue(b *bolt.Bucket, key []byte, value uint64) (err error)
- func PutVarintValue(b *bolt.Bucket, key []byte, value int64) (err error)
- func UnmarshalBinaryValue(b *bolt.Bucket, key []byte, valueObj encoding.BinaryUnmarshaler) (err error)
- func UnmarshalJsonValue(b *bolt.Bucket, key []byte, valueObj interface{}) (err error)
- func UnmarshalTextValue(b *bolt.Bucket, key []byte, valueObj encoding.TextUnmarshaler) (err error)
- func UpdateInBucket(db *bolt.DB, path Path, updateFunc func(b *bolt.Bucket) error) (err error)
- func ViewInBucket(db *bolt.DB, path Path, viewFunc func(b *bolt.Bucket) error) (err error)
- func ViewValue(db *bolt.DB, path Path, key []byte, viewFunc func(value []byte) error) (err error)
- type BinaryKey
- type Bucketeer
- func (bb *Bucketeer) DeleteNestedBucket(bucket string) error
- func (bb *Bucketeer) EnsureNestedBucket(bucket string) error
- func (bb *Bucketeer) EnsurePathBuckets() error
- func (bb *Bucketeer) ForBinaryKey(keyObj encoding.BinaryMarshaler) *Keyfarer
- func (bb *Bucketeer) ForByteKey(key []byte) *Keyfarer
- func (bb *Bucketeer) ForInt64Key(key int64) *Keyfarer
- func (bb *Bucketeer) ForJsonKey(keyObj interface{}) *Keyfarer
- func (bb *Bucketeer) ForKey(key Key) *Keyfarer
- func (bb *Bucketeer) ForStringKey(key string) *Keyfarer
- func (bb *Bucketeer) ForTextKey(keyObj encoding.TextMarshaler) *Keyfarer
- func (bb *Bucketeer) ForUint64Key(key uint64) *Keyfarer
- func (bb *Bucketeer) GetBucketStats() (stats bolt.BucketStats, err error)
- func (bb *Bucketeer) InNestedBucket(bucket string) *Bucketeer
- func (bb *Bucketeer) Update(updateFunc func(b *bolt.Bucket) error) error
- func (bb *Bucketeer) UpdateWithSequence(updateFunc func(b *bolt.Bucket, sequence uint64) error) (sequence uint64, err error)
- func (bb *Bucketeer) View(viewFunc func(b *bolt.Bucket) error) error
- type ByteKey
- type Int64Key
- type JsonKey
- type Key
- type Keyfarer
- func (kf *Keyfarer) GetByteValue() (value []byte, err error)
- func (kf *Keyfarer) GetStringValue() (value string, err error)
- func (kf *Keyfarer) GetUvarintValue() (value uint64, err error)
- func (kf *Keyfarer) GetVarintValue() (value int64, err error)
- func (kf *Keyfarer) IncrementInt64Value(value int64) (newValue int64, err error)
- func (kf *Keyfarer) IncrementUint64Value(value uint64) (newValue uint64, err error)
- func (kf *Keyfarer) PutBinaryValue(valueObj encoding.BinaryMarshaler) error
- func (kf *Keyfarer) PutByteValue(value []byte) error
- func (kf *Keyfarer) PutJsonValue(valueObj interface{}) error
- func (kf *Keyfarer) PutStringValue(value string) (err error)
- func (kf *Keyfarer) PutTextValue(valueObj encoding.TextMarshaler) (err error)
- func (kf *Keyfarer) PutUvarintValue(value uint64) error
- func (kf *Keyfarer) PutVarintValue(value int64) error
- func (kf *Keyfarer) UnmarshalBinaryValue(valueObj encoding.BinaryUnmarshaler) error
- func (kf *Keyfarer) UnmarshalJsonValue(valueObj interface{}) error
- func (kf *Keyfarer) UnmarshalTextValue(valueObj encoding.TextUnmarshaler) error
- func (kf *Keyfarer) ViewValue(viewFunc func(value []byte) error) error
- type Path
- type StringKey
- type TextKey
- type Uint64Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureNestedBucket ¶
EnsureNestedBucket creates a nested bucket if it does not exist. The bucket's full parent path must exist.
func EnsurePathBuckets ¶
EnsurePathBuckets creates any buckets along the provided path if they do not exist.
func GetBucket ¶
GetBucket retrieves the last (innermost) bucket of the provided path for use within a transaction. The bucket's full parent path must exist.
func GetByteValue ¶
GetByteValue gets the key's value as a byte slice.
func GetInt64Value ¶
GetInt64Value gets the key's value and converts its bytes into an int64 value. The value must be 8 bytes with the bits in big-endian ordering.
func GetUint64Value ¶
GetUint64Value gets the key's value and converts its bytes into a uint64 value. The value must be 8 bytes with the bits in big-endian ordering.
func GetUvarintValue ¶
GetUvarintValue gets the key's value and decodes it into a uint64 value using variable-length decoding.
func GetVarintValue ¶
GetVarintValue gets the key's value and decodes it into an int64 value using variable-length decoding.
func IncrementInt64Value ¶
IncrementInt64Value increments the key's value by the provided value, and returns the updated value.
func IncrementUint64Value ¶
IncrementUint64Value increments the key's value by the provided value, and returns the updated value.
func PutBinaryValue ¶
PutBinaryValue marshals the provided object into its binary form and sets it as the value for the key.
func PutInt64Value ¶
PutInt64Value encodes the provided int64 into big-endian bytes and sets that as the value for the key.
func PutJsonValue ¶
PutJsonValue marshals the provided object into its JSON form and sets it as the value for the key.
func PutTextValue ¶
PutTextValue marshals the provided object into its textual form and sets it as the value for the key.
func PutUint64Value ¶
PutUint64Value encodes the provided uint64 into big-endian bytes and sets that as the value for the key.
func PutUvarintValue ¶
PutUvarintValue encodes the provided uint64 into bytes using variable-length encoding and sets that as the value for the key. Values set via this method must be read using variable-length decoding.
func PutVarintValue ¶
PutVarintValue encodes the provided int64 into bytes using variable-length encoding and sets that as the value for the key. Values set via this method must be read using variable-length decoding.
func UnmarshalBinaryValue ¶
func UnmarshalBinaryValue(b *bolt.Bucket, key []byte, valueObj encoding.BinaryUnmarshaler) (err error)
UnmarshalBinaryValue gets the key's value and unmarshals it into the provided object.
func UnmarshalJsonValue ¶
UnmarshalJsonValue gets the key's value and unmarshals it into the provided object.
func UnmarshalTextValue ¶
UnmarshalTextValue gets the key's value and unmarshals it into the provided object.
func UpdateInBucket ¶
UpdateInBucket executes the provided function in an Update transaction.
func ViewInBucket ¶
ViewInBucket executes the provided function in a View transaction.
Types ¶
type BinaryKey ¶
type BinaryKey struct {
encoding.BinaryMarshaler
}
func NewBinaryKey ¶
func NewBinaryKey(keyObj encoding.BinaryMarshaler) *BinaryKey
type Bucketeer ¶
type Bucketeer struct {
// contains filtered or unexported fields
}
Bucketeer encapsulates the components needed to resolve a bucket in BoltDB and provides convenience methods for initializing Keyfarers for various key types.
func (*Bucketeer) DeleteNestedBucket ¶
DeleteNestedBucket deletes a nested bucket with the provided name.
func (*Bucketeer) EnsureNestedBucket ¶
EnsureNestedBucket creates a nested bucket if it does not exist. The bucket's full parent path must exist.
func (*Bucketeer) EnsurePathBuckets ¶
EnsurePathBuckets creates any buckets along the provided path if they do not exist.
func (*Bucketeer) ForBinaryKey ¶
func (bb *Bucketeer) ForBinaryKey(keyObj encoding.BinaryMarshaler) *Keyfarer
ForBinaryKey creates a new Keyfarer for the binary form of the provided object. If there is an error marshaling the object to binary, this function will panic.
func (*Bucketeer) ForByteKey ¶
ForByteKey creates a new Keyfarer for the provided key name.
func (*Bucketeer) ForInt64Key ¶
ForInt64Key creates a new Keyfarer for the provided key name. The key value is shifted to always be a positive number, and is stored in big-endian, fixed-length format so it is byte-sortable with other int64 keys.
func (*Bucketeer) ForJsonKey ¶
ForJsonKey creates a new Keyfarer for the JSON form of the provided object. If there is an error marshaling the object to JSON, this function will panic.
func (*Bucketeer) ForStringKey ¶
ForStringKey creates a new Keyfarer for the provided key name.
func (*Bucketeer) ForTextKey ¶
func (bb *Bucketeer) ForTextKey(keyObj encoding.TextMarshaler) *Keyfarer
ForTextKey creates a new Keyfarer for the textual form of the provided object. If there is an error marshaling the object to text, this function will panic.
func (*Bucketeer) ForUint64Key ¶
ForUint64Key creates a new Keyfarer for the provided key name. The key value is stored in big-endian, fixed-length format so it is byte-sortable with other uint64 keys.
func (*Bucketeer) GetBucketStats ¶
func (bb *Bucketeer) GetBucketStats() (stats bolt.BucketStats, err error)
GetBucketStats retrieves the BucketStats for the current bucket.
func (*Bucketeer) InNestedBucket ¶
InNestedBucket creates a new Bucketeer for a nested bucket with the provided name.
type JsonKey ¶
type JsonKey struct {
// contains filtered or unexported fields
}
func NewJsonKey ¶
func NewJsonKey(keyObj interface{}) *JsonKey
type Keyfarer ¶
type Keyfarer struct {
// contains filtered or unexported fields
}
Keyfarer encapsulates the components needed to resolve a key in BoltDB and provides convenience methods for setting and retrieving the value
func NewKeyfarer ¶
func (*Keyfarer) GetByteValue ¶
GetByteValue gets the key's value as a byte slice.
func (*Keyfarer) GetStringValue ¶
GetStringValue gets the key's value as a string.
func (*Keyfarer) GetUvarintValue ¶
func (*Keyfarer) GetVarintValue ¶
func (*Keyfarer) IncrementInt64Value ¶
func (*Keyfarer) IncrementUint64Value ¶
func (*Keyfarer) PutBinaryValue ¶
func (kf *Keyfarer) PutBinaryValue(valueObj encoding.BinaryMarshaler) error
PutBinaryValue marshals the provided object into its binary form and sets it as the value for the key.
func (*Keyfarer) PutByteValue ¶
PutByteValue sets the value for the key.
func (*Keyfarer) PutJsonValue ¶
PutJsonValue marshals the provided object into its JSON form and sets it as the value for the key.
func (*Keyfarer) PutStringValue ¶
PutByteValue sets the value for the key.
func (*Keyfarer) PutTextValue ¶
func (kf *Keyfarer) PutTextValue(valueObj encoding.TextMarshaler) (err error)
PutTextValue marshals the provided object into its textual form and sets it as the value for the key.
func (*Keyfarer) PutUvarintValue ¶
func (*Keyfarer) PutVarintValue ¶
func (*Keyfarer) UnmarshalBinaryValue ¶
func (kf *Keyfarer) UnmarshalBinaryValue(valueObj encoding.BinaryUnmarshaler) error
UnmarshalBinaryValue gets the key's value and unmarshals it into the provided object.
func (*Keyfarer) UnmarshalJsonValue ¶
UnmarshalJsonValue gets the key's value and unmarshals it into the provided object.
func (*Keyfarer) UnmarshalTextValue ¶
func (kf *Keyfarer) UnmarshalTextValue(valueObj encoding.TextUnmarshaler) error
UnmarshalTextValue gets the key's value and unmarshals it into the provided object.
type Path ¶
type Path [][]byte
Path attaches methods to [][]byte to make it more convenient to use as a sequence of BoltDB bucket names.
func (Path) Nest ¶
Nest allocates a new Path with the provided bucket name appended to the current path.
type TextKey ¶
type TextKey struct {
encoding.TextMarshaler
}
func NewTextKey ¶
func NewTextKey(keyObj encoding.TextMarshaler) *TextKey