Documentation
¶
Index ¶
- Variables
- func Key(entityID Entity, vv ...interface{}) []byte
- func PrimaryKey(tableID Entity, id uint64) []byte
- type DBDecoder
- type DBEncoder
- type DumpOptions
- type Entity
- type Query
- func (q *Query) AddFilter(filterVal ...interface{}) *Query
- func (q *Query) CurrentOffset() []byte
- func (q *Query) FilterFn(fn func(Record) bool) *Query
- func (q *Query) First() *Query
- func (q *Query) Last() *Query
- func (q *Query) Limit(limit int64) *Query
- func (q *Query) Offset(offset ...interface{}) *Query
- func (q *Query) Order(desc bool) *Query
- func (q *Query) OrderAsk() *Query
- func (q *Query) OrderDesc() *Query
- func (q *Query) String() string
- type Record
- func (r Record) Decode(v interface{}) error
- func (r Record) DecodeKey(vv ...interface{}) (err error)
- func (r Record) KeyOffset(q *Query) []byte
- func (r Record) MustDecode(v interface{})
- func (r Record) MustDecodeKey(vv ...interface{})
- func (r Record) RowID() (id uint64)
- func (r Record) String() string
- func (r Record) Table() Entity
- func (r Record) ValueBigInt() (v *big.Int)
- func (r Record) ValueID() (id uint64)
- func (r Record) ValueInt() (v int64)
- func (r Record) ValueStr() (v string)
- type Storage
- func (s *Storage) Close() error
- func (c *Storage) CountReads() int64
- func (s *Storage) Delete(key []byte) error
- func (s *Storage) Drop() error
- func (s *Storage) Dump(filepath string, options *DumpOptions) (err error)
- func (s *Storage) Exec(fn func(tx *Transaction)) (err error)
- func (s *Storage) ExecBatch(fn func(tx *Transaction)) error
- func (c *Storage) Exists(q *Query) (ok bool, err error)
- func (c *Storage) Fetch(q *Query, fnRecord func(rec Record) error) error
- func (c *Storage) FetchID(q *Query, fnRow func(id uint64) error) error
- func (c *Storage) Get(key []byte) ([]byte, error)
- func (c *Storage) GetBigInt(key []byte) (num *big.Int, err error)
- func (c *Storage) GetID(key []byte) (v uint64, err error)
- func (c *Storage) GetInt(key []byte) (num int64, err error)
- func (c *Storage) GetNumRows(q *Query) (numRows uint64, err error)
- func (c *Storage) GetStr(key []byte) (s string, err error)
- func (c *Storage) GetVar(key []byte, v interface{}) (bool, error)
- func (c *Storage) LastRowID(tableID Entity) (rowID uint64, err error)
- func (s *Storage) Open() error
- func (s *Storage) Put(key, data []byte) error
- func (s *Storage) PutID(key []byte, id uint64) error
- func (s *Storage) PutInt(key []byte, num int64) error
- func (s *Storage) PutVar(key []byte, v interface{}) error
- func (c *Storage) QueryID(q *Query) (id uint64, err error)
- func (c *Storage) QueryIDs(q *Query) (ids []uint64, err error)
- func (c *Storage) QueryValue(q *Query, v interface{}) error
- func (s *Storage) Recover() error
- func (s *Storage) RemoveByQuery(q *Query) error
- func (s *Storage) Restore(filepath string) (err error)
- func (s *Storage) Size() (size int64)
- func (s *Storage) Truncate() error
- func (s *Storage) Vacuum() (err error)
- func (s *Storage) WaitingTransactions() int64
- type Transaction
- func (t *Transaction) Commit() error
- func (c *Transaction) CountReads() int64
- func (t *Transaction) CountUpdates() int64
- func (t *Transaction) Delete(key []byte) error
- func (t *Transaction) Discard()
- func (c *Transaction) Exists(q *Query) (ok bool, err error)
- func (t *Transaction) Fail(err error)
- func (c *Transaction) Fetch(q *Query, fnRecord func(rec Record) error) error
- func (c *Transaction) FetchID(q *Query, fnRow func(id uint64) error) error
- func (c *Transaction) Get(key []byte) ([]byte, error)
- func (c *Transaction) GetBigInt(key []byte) (num *big.Int, err error)
- func (c *Transaction) GetID(key []byte) (v uint64, err error)
- func (c *Transaction) GetInt(key []byte) (num int64, err error)
- func (c *Transaction) GetNumRows(q *Query) (numRows uint64, err error)
- func (c *Transaction) GetStr(key []byte) (s string, err error)
- func (c *Transaction) GetVar(key []byte, v interface{}) (bool, error)
- func (t *Transaction) Increment(key []byte, delta int64) (v int64)
- func (t *Transaction) IncrementBig(key []byte, delta *big.Int) *big.Int
- func (c *Transaction) LastRowID(tableID Entity) (rowID uint64, err error)
- func (t *Transaction) Put(key, data []byte) error
- func (t *Transaction) PutID(key []byte, id uint64) error
- func (t *Transaction) PutInt(key []byte, num int64) error
- func (t *Transaction) PutVar(key []byte, v interface{}) error
- func (c *Transaction) QueryID(q *Query) (id uint64, err error)
- func (c *Transaction) QueryIDs(q *Query) (ids []uint64, err error)
- func (c *Transaction) QueryValue(q *Query, v interface{}) error
- func (t *Transaction) SequenceCurVal(tab Entity) (seq uint64)
- func (t *Transaction) SequenceNextVal(tab Entity) (seq uint64)
Constants ¶
This section is empty.
Variables ¶
View Source
var Break = errors.New("break of fetching")
Functions ¶
func PrimaryKey ¶
Types ¶
type DumpOptions ¶
type Query ¶
type Query struct { // results NumRows uint64 // contains filtered or unexported fields }
func (*Query) CurrentOffset ¶
type Record ¶
func (Record) MustDecodeKey ¶
func (r Record) MustDecodeKey(vv ...interface{})
func (Record) ValueBigInt ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) CountReads ¶
func (c *Storage) CountReads() int64
CountReads returns number of waiting reads
func (*Storage) Exec ¶
func (s *Storage) Exec(fn func(tx *Transaction)) (err error)
Exec executes transaction. The executing transaction can be discard by methods tx.Fail(err) or by panic(err)
func (*Storage) ExecBatch ¶
func (s *Storage) ExecBatch(fn func(tx *Transaction)) error
func (*Storage) GetNumRows ¶
GetNumRows fetches data by query and calculates count rows
func (*Storage) GetVar ¶
GetVar get data by key and unmarshal to to variable; Returns true when data by key existed
func (*Storage) QueryValue ¶
QueryValue returns first row-value by query
func (*Storage) RemoveByQuery ¶
func (*Storage) WaitingTransactions ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
func (*Transaction) CountReads ¶
func (c *Transaction) CountReads() int64
CountReads returns number of waiting reads
func (*Transaction) CountUpdates ¶
func (t *Transaction) CountUpdates() int64
func (*Transaction) Delete ¶
func (t *Transaction) Delete(key []byte) error
func (*Transaction) Discard ¶
func (t *Transaction) Discard()
func (*Transaction) Fail ¶
func (t *Transaction) Fail(err error)
func (*Transaction) GetNumRows ¶
GetNumRows fetches data by query and calculates count rows
func (*Transaction) GetVar ¶
GetVar get data by key and unmarshal to to variable; Returns true when data by key existed
func (*Transaction) Increment ¶
func (t *Transaction) Increment(key []byte, delta int64) (v int64)
Increment increments int-value by key
func (*Transaction) IncrementBig ¶
func (*Transaction) Put ¶
func (t *Transaction) Put(key, data []byte) error
func (*Transaction) PutVar ¶
func (t *Transaction) PutVar(key []byte, v interface{}) error
func (*Transaction) QueryValue ¶
QueryValue returns first row-value by query
func (*Transaction) SequenceCurVal ¶
func (t *Transaction) SequenceCurVal(tab Entity) (seq uint64)
func (*Transaction) SequenceNextVal ¶
func (t *Transaction) SequenceNextVal(tab Entity) (seq uint64)
Click to show internal directories.
Click to hide internal directories.