zbolt

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 7 Imported by: 1

README

zbolt

a boltdb wrapper

acknowledgements

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BucketNameConcat

func BucketNameConcat(slices ...[]byte) []byte

BucketNameConcat concat bytes

func BytesConcat

func BytesConcat(slices ...[]byte) []byte

BytesConcat concat bytes

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to a string without memory allocation. []byte("abc") -> "abc" s

func BytesToUint64

func BytesToUint64(v []byte) uint64

BytesToUint64 return an int64 of v v (8-byte big endian) -> uint64(123456).

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts string to a byte slice without memory allocation. "abc" -> []byte("abc")

func Uint64ToBytes

func Uint64ToBytes(v uint64) []byte

Uint64ToBytes returns an 8-byte big endian representation of v v uint64(123456) -> 8-byte big endian.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) NewTx

func (db *DB) NewTx(writable bool) *Tx

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Delete

func (tx *Tx) Delete(name []byte, keys ...[]byte) error

func (*Tx) DeleteBucket

func (tx *Tx) DeleteBucket(name []byte) error

func (*Tx) Err

func (tx *Tx) Err() error

func (*Tx) Error

func (tx *Tx) Error(err error) error

func (*Tx) ForEach

func (tx *Tx) ForEach(name []byte, fn func(k, v []byte) error) error

func (*Tx) Get

func (tx *Tx) Get(name []byte, keys ...[]byte) [][]byte

func (*Tx) Next

func (tx *Tx) Next(name []byte, key []byte, limit int) [][]byte

Next name: bucket name key: start key,if key == nil or len(key) == 0,start at first,if key not exist,return nil limit: limit count,0 representative of all

func (*Tx) NextSequence

func (tx *Tx) NextSequence(name []byte) (uint64, error)

func (*Tx) Prev

func (tx *Tx) Prev(name []byte, key []byte, limit int) [][]byte

Prev name: bucket name key: start key,if key == nil or len(key) == 0,start at last,if key not exist,return nil limit: limit count,0 representative of all

func (*Tx) Put

func (tx *Tx) Put(name []byte, kvs ...[]byte) error

func (*Tx) Rollback

func (tx *Tx) Rollback() error

func (*Tx) Sequence

func (tx *Tx) Sequence(name []byte) uint64

func (*Tx) SortDelete

func (tx *Tx) SortDelete(name []byte, keys ...[]byte) error

func (*Tx) SortDeleteBucket

func (tx *Tx) SortDeleteBucket(name []byte) error

func (*Tx) SortNext

func (tx *Tx) SortNext(name []byte, key []byte, limit int) [][]byte

SortNext name: bucket name key: start key,if key == nil or len(key) == 0,start at first,if key not exist,return nil limit: limit count,0 representative of all

func (*Tx) SortPrev

func (tx *Tx) SortPrev(name []byte, key []byte, limit int) [][]byte

SortPrev name: bucket name key: start key,if key == nil or len(key) == 0,start at last,if key not exist,return nil limit: limit count,0 representative of all

func (*Tx) SortPut

func (tx *Tx) SortPut(name []byte, sortKey []byte, kvs ...[]byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL