Documentation ¶
Index ¶
- type KeyValue
- type KeyValueDAO
- type LevelDbDAO
- func (ld LevelDbDAO) BatchDelete(keys [][]byte) error
- func (ld LevelDbDAO) BatchPut(records []KeyValue) error
- func (ld LevelDbDAO) CountByKeyPrefix(prefix []byte) int
- func (ld LevelDbDAO) CountByRange(rg *util.Range) int
- func (ld LevelDbDAO) DeleteByKey(key []byte) error
- func (ld LevelDbDAO) FindByKey(key []byte) (*KeyValue, error)
- func (ld LevelDbDAO) FindByKeyPrefix(prefix []byte, asc bool, rows int, start int) (int, []KeyValue)
- func (ld LevelDbDAO) FindByRange(rg *util.Range, asc bool, rows int, start int) (int, []KeyValue)
- func (ld LevelDbDAO) GetAllRecords() []KeyValue
- func (ld LevelDbDAO) GetNFirstPredicate(prep Predicate) []KeyValue
- func (ld LevelDbDAO) GetNFirstRecords(n int) []KeyValue
- func (ld LevelDbDAO) GetNLastRecords(n int) []KeyValue
- func (ld LevelDbDAO) Put(record KeyValue) error
- type MemDbDAO
- func (md MemDbDAO) BatchDelete(keys [][]byte) error
- func (md MemDbDAO) BatchPut(records []KeyValue) error
- func (md MemDbDAO) CountByKeyPrefix(prefix []byte) int
- func (md MemDbDAO) CountByRange(rg *util.Range) int
- func (md MemDbDAO) DeleteByKey(key []byte) error
- func (md MemDbDAO) FindByKey(key []byte) (*KeyValue, error)
- func (md MemDbDAO) FindByKeyPrefix(prefix []byte, asc bool, rows int, start int) (int, []KeyValue)
- func (md MemDbDAO) FindByRange(rg *util.Range, asc bool, rows int, start int) (int, []KeyValue)
- func (md MemDbDAO) GetAllRecords() []KeyValue
- func (md MemDbDAO) GetNFirstPredicate(prep Predicate) []KeyValue
- func (md MemDbDAO) GetNFirstRecords(n int) []KeyValue
- func (md MemDbDAO) GetNLastRecords(n int) []KeyValue
- func (md MemDbDAO) Put(record KeyValue) error
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyValue ¶
KeyValue LevelDB uses key-value struct
func CopyKeyValue ¶
CopyKeyValue clone and return enw KeyValue
type KeyValueDAO ¶
type KeyValueDAO interface { Put(record KeyValue) error BatchPut(records []KeyValue) error BatchDelete(keys [][]byte) error DeleteByKey(key []byte) error FindByKeyPrefix(prefix []byte, asc bool, rows int, start int) (int, []KeyValue) CountByKeyPrefix(prefix []byte) int FindByRange(rg *util.Range, asc bool, rows int, start int) (int, []KeyValue) CountByRange(rg *util.Range) int FindByKey(key []byte) (*KeyValue, error) GetNFirstRecords(n int) []KeyValue GetNLastRecords(n int) []KeyValue GetNFirstPredicate(pre Predicate) []KeyValue GetAllRecords() []KeyValue }
KeyValueDAO generic DAO interface for the indexer
type LevelDbDAO ¶
type LevelDbDAO struct {
// contains filtered or unexported fields
}
LevelDbDAO a dao implementation using leveldb
func NewLevelDbDAO ¶
func NewLevelDbDAO(db *leveldb.DB) LevelDbDAO
NewLevelDbDAO New instance of LevelDbDAO struct
func (LevelDbDAO) BatchDelete ¶
func (ld LevelDbDAO) BatchDelete(keys [][]byte) error
BatchDelete delete by key array
func (LevelDbDAO) BatchPut ¶
func (ld LevelDbDAO) BatchPut(records []KeyValue) error
BatchPut put an array in batch
func (LevelDbDAO) CountByKeyPrefix ¶ added in v1.0.0
func (ld LevelDbDAO) CountByKeyPrefix(prefix []byte) int
CountByKeyPrefix count by a key prefix
func (LevelDbDAO) CountByRange ¶ added in v1.0.0
func (ld LevelDbDAO) CountByRange(rg *util.Range) int
CountByRange count total of items
func (LevelDbDAO) DeleteByKey ¶
func (ld LevelDbDAO) DeleteByKey(key []byte) error
DeleteByKey delete by a key
func (LevelDbDAO) FindByKey ¶
func (ld LevelDbDAO) FindByKey(key []byte) (*KeyValue, error)
FindByKey find by a key
func (LevelDbDAO) FindByKeyPrefix ¶
func (ld LevelDbDAO) FindByKeyPrefix(prefix []byte, asc bool, rows int, start int) (int, []KeyValue)
FindByKeyPrefix find by a key prefix
func (LevelDbDAO) FindByRange ¶
FindByRange find by a range
func (LevelDbDAO) GetAllRecords ¶
func (ld LevelDbDAO) GetAllRecords() []KeyValue
GetAllRecords get all records
func (LevelDbDAO) GetNFirstPredicate ¶
func (ld LevelDbDAO) GetNFirstPredicate(prep Predicate) []KeyValue
GetNFirstPredicate go from first record until predicate evaluation is false
func (LevelDbDAO) GetNFirstRecords ¶
func (ld LevelDbDAO) GetNFirstRecords(n int) []KeyValue
GetNFirstRecords get n first records
func (LevelDbDAO) GetNLastRecords ¶
func (ld LevelDbDAO) GetNLastRecords(n int) []KeyValue
GetNLastRecords get n last records
type MemDbDAO ¶
type MemDbDAO struct {
// contains filtered or unexported fields
}
MemDbDAO an in-memory dao implementation using memdb package of leveldb
func (MemDbDAO) BatchDelete ¶
BatchDelete implement interface
func (MemDbDAO) CountByKeyPrefix ¶ added in v1.0.0
CountByKeyPrefix count by key prefix
func (MemDbDAO) CountByRange ¶ added in v1.0.0
CountByRange count total of items
func (MemDbDAO) DeleteByKey ¶
DeleteByKey implement interface
func (MemDbDAO) FindByKeyPrefix ¶
FindByKeyPrefix implement interface
func (MemDbDAO) FindByRange ¶
FindByRange find by a range
func (MemDbDAO) GetAllRecords ¶
GetAllRecords implement interface
func (MemDbDAO) GetNFirstPredicate ¶
GetNFirstPredicate go from first record until predicate evaluation is false
func (MemDbDAO) GetNFirstRecords ¶
GetNFirstRecords implement interface
func (MemDbDAO) GetNLastRecords ¶
GetNLastRecords implement interface