Documentation ¶
Index ¶
- Constants
- Variables
- func Bytes2str(b []byte) string
- func BytesToInt64(buf []byte) int64
- func IncrSignal(val int64) int64
- func Int64ToBytes(i int64) []byte
- func NewRocksDB(dir string) *gorocksdb.DB
- func SplitKeyName(key []byte) (string, string)
- func Str2bytes(s string) []byte
- type Counter
- type Counters
- type DB
- func (d *DB) Close()
- func (d *DB) Delete(key []byte) error
- func (d *DB) Enumerate(iter *gorocksdb.Iterator, min, max []byte, direction IterDirection, ...)
- func (d *DB) FLushAll()
- func (d *DB) Get(key []byte) ([]byte, error)
- func (d *DB) GetList(key []byte) ([]byte, error)
- func (d *DB) Keys() []string
- func (d *DB) List(key []byte) *ListElement
- func (d *DB) PrefixEnumerate(prefix []byte, direction IterDirection, ...)
- func (d *DB) RangeEnumerate(min, max []byte, direction IterDirection, ...)
- func (d *DB) RawDelete(key []byte) error
- func (d *DB) RawGet(key []byte) ([]byte, error)
- func (d *DB) RawSet(key, value []byte) error
- func (d *DB) Set(key, value []byte) error
- func (d *DB) TypeOf(key []byte) ElementType
- func (d *DB) WriteBatch(batch *gorocksdb.WriteBatch) error
- type ElementType
- type IterDirection
- type Iterator
- type ListElement
- func (l *ListElement) Drop() error
- func (l *ListElement) Exist() (bool, error)
- func (l *ListElement) Index(i int64) ([]byte, error)
- func (l *ListElement) LPop() ([]byte, error)
- func (l *ListElement) LPush(vals ...[]byte) error
- func (l *ListElement) Len() int64
- func (l *ListElement) Ltrim(start, stop int) error
- func (l *ListElement) RPop() ([]byte, error)
- func (l *ListElement) RPush(vals ...[]byte) error
- func (l *ListElement) Range(start, stop int, fn func(i int, value []byte, quit *bool)) error
Constants ¶
View Source
const ( STRING ElementType = 's' HASH = 'h' LIST = 'l' SORTEDSET = 'z' NONE = '0' )
View Source
const ( MINBYTE byte = 0 MAXBYTE byte = math.MaxUint8 )
字节范围
Variables ¶
View Source
var ( SEP = []byte{','} KEY = []byte{'+'} // Key Prefix SOK = []byte{'['} // Start of Key EOK = []byte{']'} // End of Key )
View Source
var KEY_EXIST = []byte("1")
View Source
var KEY_NOT_EXIST = []byte("0")
Functions ¶
func BytesToInt64 ¶
func IncrSignal ¶
func NewRocksDB ¶
func SplitKeyName ¶
Types ¶
type Counter ¶
type Counter int64
Atomic Counter, simple enough, easy to Incr/Decr c := Counter(0) c.SetCount(100) c.Incr(1) or c.Decr(1) fmt.Println(c) or c.Count()
type Counters ¶
type Counters struct {
// contains filtered or unexported fields
}
Counter Collection factory := NewFactory() factory.Get("set").Incr(1) factory.Get("get").Incr(1) factory.Get("del").Incr(1) factory.Get("total").Incr(3)
func NewCounters ¶
func NewCounters() *Counters
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) Enumerate ¶
func (d *DB) Enumerate(iter *gorocksdb.Iterator, min, max []byte, direction IterDirection, fn func(i int, key, value []byte, quit *bool))
范围扫描
func (*DB) List ¶
func (d *DB) List(key []byte) *ListElement
func (*DB) PrefixEnumerate ¶
func (d *DB) PrefixEnumerate(prefix []byte, direction IterDirection, fn func(i int, key, value []byte, quit *bool))
前缀扫描
func (*DB) RangeEnumerate ¶
func (*DB) TypeOf ¶
func (d *DB) TypeOf(key []byte) ElementType
func (*DB) WriteBatch ¶
func (d *DB) WriteBatch(batch *gorocksdb.WriteBatch) error
type ElementType ¶
type ElementType byte
func (ElementType) String ¶
func (e ElementType) String() string
type ListElement ¶
type ListElement struct {
// contains filtered or unexported fields
}
func NewHashElement ¶
func NewHashElement(db *DB, key []byte) *ListElement
func NewListElement ¶
func NewListElement(db *DB, key []byte) *ListElement
func NewSortedSetElement ¶
func NewSortedSetElement(db *DB, key []byte) *ListElement
func (*ListElement) Drop ¶
func (l *ListElement) Drop() error
func (*ListElement) LPop ¶
func (l *ListElement) LPop() ([]byte, error)
func (*ListElement) LPush ¶
func (l *ListElement) LPush(vals ...[]byte) error
func (*ListElement) Len ¶
func (l *ListElement) Len() int64
func (*ListElement) Ltrim ¶
func (l *ListElement) Ltrim(start, stop int) error
func (*ListElement) RPop ¶
func (l *ListElement) RPop() ([]byte, error)
func (*ListElement) RPush ¶
func (l *ListElement) RPush(vals ...[]byte) error
Click to show internal directories.
Click to hide internal directories.