Documentation ¶
Index ¶
- Constants
- func BuildScript(raw ...string) luaScript
- type Cmd
- type DB
- func (db *DB) Clear() error
- func (db *DB) Close() error
- func (db *DB) Del(key []byte) error
- func (db *DB) Eval(script luaScript) (*Cmd, error)
- func (db *DB) Fold(fn func(key []byte, value []byte) bool) error
- func (db *DB) Get(key []byte) ([]byte, error)
- func (db *DB) GetTxId() int64
- func (db *DB) IsExist(key []byte) (bool, error)
- func (db *DB) ListKeys() [][]byte
- func (db *DB) Merge() error
- func (db *DB) NewIterator(options IteratorOptions) *Iterator
- func (db *DB) NewWriteBatch(opts WriteBatchOptions) *WriteBatch
- func (db *DB) Notify(key string, value []byte, entryType eventType)
- func (db *DB) Persist(key []byte)
- func (db *DB) Put(key, value []byte) error
- func (db *DB) PutWithExpiration(key, value []byte, duration time.Duration) error
- func (db *DB) RWTransaction(retryOnConflict bool, fn func(txn *Txn) error) error
- func (db *DB) SerialTransaction(readOnly bool, fn func(txn *Txn) error) error
- func (db *DB) Size() int
- func (db *DB) Sync() error
- func (db *DB) UnWatch(watcher *Watcher)
- func (db *DB) Watch(ctx context.Context, key string) <-chan *watchEvent
- type IsolationLevel
- type Iterator
- type IteratorOptions
- type LuaScriptBuilder
- func (b *LuaScriptBuilder) Build() luaScript
- func (b *LuaScriptBuilder) DeclareArray(name string, values []string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) Del(key string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) Else(fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
- func (b *LuaScriptBuilder) ElseIf(condition string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
- func (b *LuaScriptBuilder) For(init, condition, step string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
- func (b *LuaScriptBuilder) GetArrayLength(name string) string
- func (b *LuaScriptBuilder) GetValueFromArray(name, index string) string
- func (b *LuaScriptBuilder) If(condition string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
- func (b *LuaScriptBuilder) Put(key, value string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) Raw(raw ...string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) RawCode(code string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) Set(key, value string) *LuaScriptBuilder
- func (b *LuaScriptBuilder) SetValueInArray(name, index, value string) *LuaScriptBuilder
- type Options
- func (o *Options) SetDataFileSizeByte(size int64) *Options
- func (o *Options) SetDataFileSizeGB(size int64) *Options
- func (o *Options) SetDataFileSizeKB(size int64) *Options
- func (o *Options) SetDataFileSizeMB(size int64) *Options
- func (o *Options) SetDirPath(path string) *Options
- func (o *Options) SetIndexType(typ meta.MemTableType) *Options
- func (o *Options) SetSyncWrites(sync bool) *Options
- type Txn
- func (txn *Txn) Append(key []byte, value []byte) error
- func (txn *Txn) Decr(key []byte) (int, error)
- func (txn *Txn) DecrBy(key []byte, delta int) (int, error)
- func (txn *Txn) Del(key []byte) error
- func (txn *Txn) Exist(key []byte) bool
- func (txn *Txn) Get(key []byte) ([]byte, error)
- func (txn *Txn) GetSet(key, value []byte) ([]byte, error)
- func (txn *Txn) HDel(key, field []byte) error
- func (txn *Txn) HExist(key, field []byte) bool
- func (txn *Txn) HGet(key, field []byte) ([]byte, error)
- func (txn *Txn) HGetAll(key []byte) ([][]byte, [][]byte, error)
- func (txn *Txn) HKeys(key []byte) ([][]byte, error)
- func (txn *Txn) HLen(key []byte) (int64, error)
- func (txn *Txn) HMGet(key []byte, fields [][]byte) ([][]byte, error)
- func (txn *Txn) HMSet(key []byte, args [][]byte) error
- func (txn *Txn) HSet(key, field, value []byte) error
- func (txn *Txn) HStrLen(key, field []byte) (int64, error)
- func (txn *Txn) HValues(key []byte) ([][]byte, error)
- func (txn *Txn) Incr(key []byte) (int, error)
- func (txn *Txn) IncrBy(key []byte, delta int) (int, error)
- func (txn *Txn) LIndex(key []byte, index int) ([]byte, error)
- func (txn *Txn) LLen(key []byte) (int, error)
- func (txn *Txn) LPop(key []byte) ([]byte, error)
- func (txn *Txn) LPush(key []byte, values [][]byte) error
- func (txn *Txn) LRange(key []byte, start, stop int) ([][]byte, error)
- func (txn *Txn) LRem(key []byte, index int) error
- func (txn *Txn) LSet(key []byte, index int, value []byte) error
- func (txn *Txn) LTrim(key []byte, start, stop int) error
- func (txn *Txn) MGet(keys [][]byte) ([][]byte, error)
- func (txn *Txn) MSet(args [][]byte) error
- func (txn *Txn) RPop(key []byte) ([]byte, error)
- func (txn *Txn) RPush(key []byte, values [][]byte) error
- func (txn *Txn) SAdd(key []byte, members ...[]byte) error
- func (txn *Txn) SCard(key []byte) (int64, error)
- func (txn *Txn) SMembers(key []byte) ([][]byte, error)
- func (txn *Txn) SRem(key []byte, members ...[]byte) error
- func (txn *Txn) Set(key []byte, value []byte) error
- func (txn *Txn) SetEX(key, value []byte) error
- func (txn *Txn) SetNX(key, value []byte) error
- func (txn *Txn) StrLen(key []byte) (int, error)
- type Watcher
- type WriteBatch
- type WriteBatchOptions
Constants ¶
View Source
const ( PutEvent eventType = iota DelEvent )
View Source
const MaxDuration time.Duration = 1<<63 - 1
Variables ¶
This section is empty.
Functions ¶
func BuildScript ¶
func BuildScript(raw ...string) luaScript
Types ¶
type DB ¶
func NewCouloyDB ¶
func (*DB) Fold ¶
Fold gets all the keys and executes the function passed in by the user. Terminates the traversal when the function returns false
func (*DB) NewIterator ¶
func (db *DB) NewIterator(options IteratorOptions) *Iterator
func (*DB) NewWriteBatch ¶
func (db *DB) NewWriteBatch(opts WriteBatchOptions) *WriteBatch
func (*DB) PutWithExpiration ¶
func (*DB) RWTransaction ¶
RWTransaction Read/Write transaction if retryOnConflict is true, then the transaction will automatically retry until the transaction commits correctly fn is the real transaction that you want to perform
func (*DB) SerialTransaction ¶
SerialTransaction serializable transaction For now, the commit of a serializable transaction is unlikely to conflict so no retry is required
type IsolationLevel ¶
type IsolationLevel uint8
const ( ReadCommitted IsolationLevel = iota Serializable )
type IteratorOptions ¶
type LuaScriptBuilder ¶
type LuaScriptBuilder struct {
// contains filtered or unexported fields
}
func NewLuaScriptBuilder ¶
func NewLuaScriptBuilder() *LuaScriptBuilder
func (*LuaScriptBuilder) Build ¶
func (b *LuaScriptBuilder) Build() luaScript
func (*LuaScriptBuilder) DeclareArray ¶
func (b *LuaScriptBuilder) DeclareArray(name string, values []string) *LuaScriptBuilder
func (*LuaScriptBuilder) Del ¶
func (b *LuaScriptBuilder) Del(key string) *LuaScriptBuilder
func (*LuaScriptBuilder) Else ¶
func (b *LuaScriptBuilder) Else(fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
func (*LuaScriptBuilder) ElseIf ¶
func (b *LuaScriptBuilder) ElseIf(condition string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
func (*LuaScriptBuilder) For ¶
func (b *LuaScriptBuilder) For(init, condition, step string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
func (*LuaScriptBuilder) GetArrayLength ¶
func (b *LuaScriptBuilder) GetArrayLength(name string) string
func (*LuaScriptBuilder) GetValueFromArray ¶
func (b *LuaScriptBuilder) GetValueFromArray(name, index string) string
func (*LuaScriptBuilder) If ¶
func (b *LuaScriptBuilder) If(condition string, fn func(builder *LuaScriptBuilder)) *LuaScriptBuilder
func (*LuaScriptBuilder) Put ¶
func (b *LuaScriptBuilder) Put(key, value string) *LuaScriptBuilder
func (*LuaScriptBuilder) Raw ¶
func (b *LuaScriptBuilder) Raw(raw ...string) *LuaScriptBuilder
func (*LuaScriptBuilder) RawCode ¶
func (b *LuaScriptBuilder) RawCode(code string) *LuaScriptBuilder
func (*LuaScriptBuilder) Set ¶
func (b *LuaScriptBuilder) Set(key, value string) *LuaScriptBuilder
func (*LuaScriptBuilder) SetValueInArray ¶
func (b *LuaScriptBuilder) SetValueInArray(name, index, value string) *LuaScriptBuilder
type Options ¶
type Options struct { DirPath string DataFileSize int64 IndexType meta.MemTableType SyncWrites bool BytesPerSync uint64 MergeInterval int64 EnableLuaInterpreter bool SerializableLua bool }
func DefaultOptions ¶
func DefaultOptions() Options
func (*Options) SetDataFileSizeByte ¶
func (*Options) SetDataFileSizeGB ¶
func (*Options) SetDataFileSizeKB ¶
func (*Options) SetDataFileSizeMB ¶
func (*Options) SetDirPath ¶
func (*Options) SetIndexType ¶
func (o *Options) SetIndexType(typ meta.MemTableType) *Options
func (*Options) SetSyncWrites ¶
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
func (*Txn) Del ¶
Del delete data to the db, but instead of writing it back to memtable, it writes to pendingWrites first
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
WriteBatch Atomic operation writeBatch
func (*WriteBatch) Commit ¶
func (wb *WriteBatch) Commit() error
func (*WriteBatch) Del ¶
func (wb *WriteBatch) Del(key []byte) error
type WriteBatchOptions ¶
func DefaultBatchOptions ¶
func DefaultBatchOptions() WriteBatchOptions
Source Files ¶
Click to show internal directories.
Click to hide internal directories.