Documentation ¶
Index ¶
- Variables
- func NewDB(path string, syncWrite, Compression bool, maxMemory int64) (*badger.DB, error)
- func SetCodec(codec Codec) error
- type Codec
- type DBStruct
- type HashMap
- func (l *HashMap) All(elementid []byte, Reverse bool) ([][]byte, error)
- func (h *HashMap) AllElementId(Reverse bool) ([][]byte, error)
- func (l *HashMap) AllKV(elementid []byte, Reverse bool) (map[string][]byte, error)
- func (l *HashMap) BeginWrite() error
- func (h *HashMap) Clear() error
- func (l *HashMap) Close() error
- func (l *HashMap) Commit() error
- func (h *HashMap) Decr(elementid, key []byte) error
- func (h *HashMap) DecrBy(elementid, key []byte, v uint64) error
- func (h *HashMap) Del(elementid []byte) error
- func (h *HashMap) DelKey(elementid, key []byte) error
- func (h *HashMap) Exists(elementid []byte) (bool, error)
- func (h *HashMap) Get(elementid, key []byte) ([]byte, error)
- func (h *HashMap) GetWithCodec(elementid, key []byte, value interface{}) error
- func (h *HashMap) Has(elementid, key []byte) (bool, error)
- func (h *HashMap) HashKeys(elementid []byte, prefix []byte) ([][]byte, error)
- func (h *HashMap) INT64(elementid, key []byte) (int64, error)
- func (h *HashMap) Incr(elementid, key []byte) error
- func (h *HashMap) IncrBy(elementid, key []byte, v uint64) error
- func (h *HashMap) Keys(owner []byte) ([][]byte, error)
- func (h *HashMap) Len(elementid []byte) int
- func (h *HashMap) RangeRev(elementid []byte, startPos, limit int64) ([][]byte, error)
- func (h *HashMap) Set(elementid, key, value []byte) error
- func (h *HashMap) SetTTL(elementid, key, value []byte, ttl time.Duration) error
- func (h *HashMap) SetTTLWithCodec(elementid, key []byte, value interface{}, ttl time.Duration) error
- func (h *HashMap) SetWithCodec(elementid, key []byte, value interface{}) error
- func (h *HashMap) TTL(elementid, key []byte) (int64, error)
- func (h *HashMap) UINT64(elementid, key []byte) (uint64, error)
- type Hyperloglog
- type KeyValue
- func (l *KeyValue) BeginWrite() error
- func (kv *KeyValue) Clear() error
- func (l *KeyValue) Close() error
- func (l *KeyValue) Commit() error
- func (kv *KeyValue) Del(key []byte) error
- func (kv *KeyValue) DelTx(tx *badger.Txn, key []byte) error
- func (kv *KeyValue) Get(key []byte) ([]byte, error)
- func (kv *KeyValue) GetWithCodec(key []byte, value interface{}) error
- func (kv *KeyValue) Inc(key []byte) ([]byte, error)
- func (kv *KeyValue) Set(key, value []byte) error
- func (kv *KeyValue) SetBatch(key, value [][]byte) error
- func (kv *KeyValue) SetBatchWithCodec(data map[string]interface{}) error
- func (kv *KeyValue) SetTX(tx *badger.Txn, key, value []byte) error
- func (kv *KeyValue) SetTXWithCodec(tx *badger.Txn, key []byte, value interface{}) error
- func (kv *KeyValue) SetWithCodec(key []byte, value interface{}) error
- type List
- func (l *List) Add(value []byte) error
- func (l *List) AddBatch(value [][]byte) error
- func (l *List) AddBatchTTL(value [][]byte, nt time.Duration) error
- func (l *List) AddTTL(value []byte, nt time.Duration) error
- func (l *List) AddTTLWithCodec(value interface{}, ttl time.Duration) error
- func (l *List) AddTx(tx *badger.Txn, value []byte) error
- func (l *List) AddTxTTL(tx *badger.Txn, value []byte, nt time.Duration) error
- func (l *List) AddTxWB(tx *badger.WriteBatch, value []byte) error
- func (l *List) AddTxWBTTL(tx *badger.WriteBatch, value []byte, nt time.Duration) error
- func (l *List) AddWithCodec(value interface{}) error
- func (l *List) All(Reverse bool) ([][]byte, error)
- func (l *List) BeginWrite() error
- func (l *List) Clear() error
- func (l *List) Close() error
- func (l *List) Commit() error
- func (l *List) KeepFrontData(keep int) error
- func (l *List) Last() ([]byte, error)
- func (l *List) LastN(n int) ([][]byte, error)
- func (l *List) Len() int
- func (l *List) RangeRev(startPos, limit int64) ([][]byte, error)
- func (l *List) RemoveLast() error
- type MsgpackCodec
- type ProtoCodec
- type Set
- func (s *Set) Add(value []byte) error
- func (s *Set) AddBatchTx(value [][]byte, ttl time.Duration) error
- func (s *Set) AddTTL(value []byte, ttl time.Duration) error
- func (s *Set) All(Reverse bool) ([][]byte, error)
- func (l *Set) BeginWrite() error
- func (s *Set) Clear() error
- func (l *Set) Close() error
- func (l *Set) Commit() error
- func (s *Set) Del(value []byte) error
- func (s *Set) Has(value []byte) (bool, error)
- func (s *Set) RemoveLast() error
- type TestMsg
- func (*TestMsg) Descriptor() ([]byte, []int)
- func (m *TestMsg) GetAbc() string
- func (m *TestMsg) GetIntv32() int32
- func (m *TestMsg) GetIntv64() int64
- func (m *TestMsg) Marshal() (dAtA []byte, err error)
- func (m *TestMsg) MarshalTo(dAtA []byte) (int, error)
- func (m *TestMsg) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TestMsg) ProtoMessage()
- func (m *TestMsg) Reset()
- func (m *TestMsg) Size() (n int)
- func (m *TestMsg) String() string
- func (m *TestMsg) Unmarshal(dAtA []byte) error
- func (m *TestMsg) XXX_DiscardUnknown()
- func (m *TestMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestMsg) XXX_Merge(src proto.Message)
- func (m *TestMsg) XXX_Size() int
- func (m *TestMsg) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotSetCodec = errors.New("not set codec plugin") ErrInvaildProtoType = errors.New("Invaild Protobuf type") )
View Source
var ( ErrDatabaseUnopen = errors.New("database Unopen") // ErrKeyNotFound will be returned if the key was not found in a HashMap or KeyValue struct ErrKeyNotFound = errors.New("Key not found") // ErrDoesNotExist will be returned if an element was not found. Used in List, Set, HashMap and KeyValue. ErrDoesNotExist = errors.New("Does not exist") // ErrExistsInSet is only returned if an element is added to a Set, but it already exists ErrExistsInSet = errors.New("Element already exists in set") // ErrInvalidID is only returned if adding an element to a HashMap that contains a colon (:) ErrInvalidID = errors.New("Element ID can not contain \":\"") // ErrOnlyUseTx = errors.New("Tx Mode ,Only Use AddTx Or AddTxTTL") ErrKeyValueCountNotEqual = errors.New("Key And Value Count Not Equal") )
Functions ¶
Types ¶
type Codec ¶
type Codec interface { InitCodec() error Marshal(value interface{}) ([]byte, error) Unmarshal(data []byte, value interface{}) error Name() string }
codec for protobuf or msgpack or other type codec
type DBStruct ¶
type DBStruct struct {
// contains filtered or unexported fields
}
Used for each of the datatypes
type HashMap ¶
type HashMap DBStruct
HASHMAP数据结构
func NewHashMap ¶
Create Hash Map Sturct
func (*HashMap) AllElementId ¶
Get Element All Values
func (*HashMap) BeginWrite ¶
func (*HashMap) GetWithCodec ¶
func (*HashMap) SetTTLWithCodec ¶
func (*HashMap) SetWithCodec ¶
Set Element Key And Value With Codec
type Hyperloglog ¶
type Hyperloglog struct { DBStruct // contains filtered or unexported fields }
type KeyValue ¶
type KeyValue DBStruct
func NewKeyValue ¶
func (*KeyValue) BeginWrite ¶
func (*KeyValue) GetWithCodec ¶
func (*KeyValue) SetBatchWithCodec ¶
func (*KeyValue) SetTXWithCodec ¶
func (*KeyValue) SetWithCodec ¶
type List ¶
type List DBStruct
List数据结构
func (*List) AddTTLWithCodec ¶
func (*List) AddTxWBTTL ¶
func (*List) AddWithCodec ¶
func (*List) BeginWrite ¶
func (*List) KeepFrontData ¶
type MsgpackCodec ¶
type MsgpackCodec struct{}
msgpack codec
func (*MsgpackCodec) InitCodec ¶
func (c *MsgpackCodec) InitCodec() error
func (*MsgpackCodec) Marshal ¶
func (c *MsgpackCodec) Marshal(value interface{}) ([]byte, error)
func (*MsgpackCodec) Name ¶
func (c *MsgpackCodec) Name() string
func (*MsgpackCodec) Unmarshal ¶
func (c *MsgpackCodec) Unmarshal(data []byte, value interface{}) error
type ProtoCodec ¶
type ProtoCodec struct{}
protobuf codec
func (*ProtoCodec) InitCodec ¶
func (c *ProtoCodec) InitCodec() error
func (*ProtoCodec) Marshal ¶
func (c *ProtoCodec) Marshal(value interface{}) ([]byte, error)
func (*ProtoCodec) Name ¶
func (c *ProtoCodec) Name() string
func (*ProtoCodec) Unmarshal ¶
func (c *ProtoCodec) Unmarshal(data []byte, value interface{}) error
type Set ¶
type Set DBStruct
SET数据结构
func (*Set) BeginWrite ¶
type TestMsg ¶
type TestMsg struct { Abc string `protobuf:"bytes,1,opt,name=abc,proto3" json:"abc,omitempty"` Intv32 int32 `protobuf:"zigzag32,2,opt,name=intv32,proto3" json:"intv32,omitempty"` Intv64 int64 `protobuf:"zigzag64,3,opt,name=intv64,proto3" json:"intv64,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TestMsg) Descriptor ¶
func (*TestMsg) MarshalToSizedBuffer ¶
func (*TestMsg) ProtoMessage ¶
func (*TestMsg) ProtoMessage()
func (*TestMsg) XXX_DiscardUnknown ¶
func (m *TestMsg) XXX_DiscardUnknown()
func (*TestMsg) XXX_Marshal ¶
func (*TestMsg) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.