Documentation ¶
Index ¶
Constants ¶
const ( OrderNone = Order(0) OrderAsc = Order(1) OrderDesc = Order(2) )
Order options.
Variables ¶
var CollectionKeyHeader = kv.CollectionKeyHeader
var DatabaseKeyHeader = kv.DatabaseKeyHeader
var DocumentKeyHeader = kv.DocumentKeyHeader
var ErrNotExist = document.ErrNotExist
var NoLimit = int(0)
NoLimit represents a no limit option.
var NoOffset = uint(0)
NoOffset represents a no offset option.
var PrimaryIndexHeader = kv.PrimaryIndexHeader
var SecondaryIndexHeader = kv.SecondaryIndexHeader
Functions ¶
func NewErrObjectNotExist ¶ added in v1.3.0
Types ¶
type HeaderType ¶
type HeaderType = kv.HeaderType
KeyHeader represents a key header in the key-value store.
type Key ¶
Key represents a key in the key-value store.
func NewKeyWith ¶
NewKeyWith returns a new key from the specified header and key elements.
type LimitOption ¶ added in v1.0.0
type LimitOption struct {
Limit int
}
LimitOption represents a limit option.
func NewLimitOption ¶ added in v1.0.0
func NewLimitOption(limit int) *LimitOption
NewLimitOption returns a new limit option.
type Object ¶
type Object interface { // Key returns a key of the object. Key() Key // Value returns a value of the object. Value() []byte }
Object reprease a key-value object.
type OffsetOption ¶ added in v1.0.0
type OffsetOption struct {
Offset uint
}
OffsetOption represents an offset option.
func NewOffsetOption ¶ added in v1.0.0
func NewOffsetOption(offset uint) *OffsetOption
NewLimitOption returns a new offset option.
type OrderOption ¶ added in v1.0.0
type OrderOption struct {
Order Order
}
OrderOption represents a order option.
func NewOrderOptionWith ¶ added in v1.0.0
func NewOrderOptionWith(order Order) *OrderOption
NewOrderOptionWith returns a new order option.
type ResultSet ¶
type ResultSet interface { // Next moves the cursor forward next object from its current position. Next() bool // Object returns an object in the current cursor. Object() (Object, error) }
ResultSet represents a result set which includes query execution results.
type Store ¶
type Store interface { document.KeyCoder // SetKeyCoder sets the key coder. SetKeyCoder(coder document.KeyCoder) // Transact begin a new transaction. Transact(write bool) (Transaction, error) }
Store represents a store interface.
type Transaction ¶
type Transaction interface { // Set stores a key-value object. If the key already holds some value, it is overwritten. Set(obj Object) error // Get returns a key-value object of the specified key. Get(key Key) (Object, error) // GetRange returns a result set of the specified key. GetRange(key Key, opts ...Option) (ResultSet, error) // Remove removes the specified key-value object. Remove(key Key) error // RemoveRange removes the specified key-value objects. RemoveRange(key Key) error // Commit commits this transaction. Commit() error // Cancel cancels this transaction. Cancel() error // SetTimeout sets the timeout of this transaction. SetTimeout(t time.Duration) error }
Transaction represents a transaction interface.