Documentation ¶
Index ¶
- Constants
- Variables
- func IsNotFound(err error) bool
- func IsSkipError(err error) bool
- func IsValidName(name string) bool
- func NewTableClosedErr(tableName string) error
- func RemoveStore(path string) error
- func Skip() (bool, error)
- type BaseObjectEncoder
- type BoolValueEncoder
- type BytesValueEncoder
- type CounterTable
- type DB
- type DataType
- type IntValueEncoder
- type Item
- type IteratorFunc
- type IteratorOptions
- type Logger
- type NilValueEncoder
- type Query
- func (this *Query[T]) Desc() *Query[T]
- func (this *Query[T]) FieldAsc(fieldName string) *Query[T]
- func (this *Query[T]) FieldDesc(fieldName string) *Query[T]
- func (this *Query[T]) FieldOffset(fieldOffset []byte) *Query[T]
- func (this *Query[T]) FieldPrefix(fieldName string, fieldPrefix string) *Query[T]
- func (this *Query[T]) FindAll(fn IteratorFunc[T]) (err error)
- func (this *Query[T]) ForField() *Query[T]
- func (this *Query[T]) ForKey() *Query[T]
- func (this *Query[T]) ForUpdate() *Query[T]
- func (this *Query[T]) KeysOnly() *Query[T]
- func (this *Query[T]) Limit(limit int) *Query[T]
- func (this *Query[T]) Offset(offsetKey string) *Query[T]
- func (this *Query[T]) Prefix(prefix string) *Query[T]
- func (this *Query[T]) SetTable(table *Table[T]) *Query[T]
- func (this *Query[T]) SetTx(tx *Tx[T]) *Query[T]
- type QueryOperator
- type QueryOperatorInfo
- type Store
- func (this *Store) Close() error
- func (this *Store) Delete(keyBytes []byte) error
- func (this *Store) Flush() error
- func (this *Store) Get(keyBytes []byte) (valueBytes []byte, closer io.Closer, err error)
- func (this *Store) IsClosed() bool
- func (this *Store) NewDB(dbName string) (*DB, error)
- func (this *Store) Open() error
- func (this *Store) RawDB() *pebble.DB
- func (this *Store) Set(keyBytes []byte, valueBytes []byte) error
- type StringValueEncoder
- type Table
- func (this *Table[T]) AddField(fieldName string) error
- func (this *Table[T]) AddFields(fieldName ...string) error
- func (this *Table[T]) Close() error
- func (this *Table[T]) ComposeFieldKey(keyBytes []byte, fieldName string, fieldValueBytes []byte) []byte
- func (this *Table[T]) Count() (int64, error)
- func (this *Table[T]) DB() *DB
- func (this *Table[T]) DecodeFieldKey(fieldName string, fieldKey []byte) (fieldValue []byte, key []byte, err error)
- func (this *Table[T]) Delete(key ...string) error
- func (this *Table[T]) DeleteRange(start string, end string) error
- func (this *Table[T]) DropField(fieldName string) error
- func (this *Table[T]) Encoder() ValueEncoder[T]
- func (this *Table[T]) Exist(key string) (found bool, err error)
- func (this *Table[T]) FieldKey(fieldName string) []byte
- func (this *Table[T]) FullKey(realKey string) []byte
- func (this *Table[T]) FullKeyBytes(realKeyBytes []byte) []byte
- func (this *Table[T]) Get(key string) (value T, err error)
- func (this *Table[T]) Insert(key string, value T) error
- func (this *Table[T]) Name() string
- func (this *Table[T]) Namespace() []byte
- func (this *Table[T]) Query() *Query[T]
- func (this *Table[T]) ReadTx(fn func(tx *Tx[T]) error) error
- func (this *Table[T]) Set(key string, value T) error
- func (this *Table[T]) SetDB(db *DB)
- func (this *Table[T]) SetNamespace(namespace []byte)
- func (this *Table[T]) SetSync(key string, value T) error
- func (this *Table[T]) Truncate() error
- func (this *Table[T]) WriteTx(fn func(tx *Tx[T]) error) error
- func (this *Table[T]) WriteTxSync(fn func(tx *Tx[T]) error) error
- type TableInterface
- type Tx
- func (this *Tx[T]) Close() error
- func (this *Tx[T]) Commit() (err error)
- func (this *Tx[T]) CommitSync() (err error)
- func (this *Tx[T]) Delete(key string) error
- func (this *Tx[T]) Get(key string) (value T, err error)
- func (this *Tx[T]) Insert(key string, value T) error
- func (this *Tx[T]) NewIterator(opt *IteratorOptions) (*pebble.Iterator, error)
- func (this *Tx[T]) Query() *Query[T]
- func (this *Tx[T]) Set(key string, value T) error
- func (this *Tx[T]) SetSync(key string, value T) error
- type ValueEncoder
Constants ¶
View Source
const ( KeyPrefix = "K$" KeyMaxLength = 8 << 10 FieldPrefix = "F$" MaxBatchKeys = 8 << 10 // TODO not implemented )
View Source
const StoreSuffix = ".store"
Variables ¶
View Source
var DefaultWriteOptions = &pebble.WriteOptions{ Sync: false, }
View Source
var DefaultWriteSyncOptions = &pebble.WriteOptions{ Sync: true, }
View Source
var ErrKeyTooLong = errors.New("too long key")
View Source
var ErrSkip = errors.New("skip") // skip count in iterator
View Source
var ErrTableClosed = errors.New("table closed")
View Source
var ErrTableNotFound = errors.New("table not found")
Functions ¶
func IsNotFound ¶ added in v1.3.5
func IsSkipError ¶ added in v1.3.5
func IsValidName ¶
IsValidName check if store name or database name or table name is valid
func NewTableClosedErr ¶ added in v1.3.5
Types ¶
type BaseObjectEncoder ¶
type BaseObjectEncoder[T any] struct { }
func (*BaseObjectEncoder[T]) Decode ¶
func (this *BaseObjectEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*BaseObjectEncoder[T]) Encode ¶
func (this *BaseObjectEncoder[T]) Encode(value T) ([]byte, error)
type BoolValueEncoder ¶
type BoolValueEncoder[T bool] struct { }
func NewBoolValueEncoder ¶
func NewBoolValueEncoder[T bool]() *BoolValueEncoder[T]
func (*BoolValueEncoder[T]) Decode ¶
func (this *BoolValueEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*BoolValueEncoder[T]) Encode ¶
func (this *BoolValueEncoder[T]) Encode(value T) ([]byte, error)
func (*BoolValueEncoder[T]) EncodeField ¶
func (this *BoolValueEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type BytesValueEncoder ¶
type BytesValueEncoder[T []byte] struct { }
func NewBytesValueEncoder ¶
func NewBytesValueEncoder[T []byte]() *BytesValueEncoder[T]
func (*BytesValueEncoder[T]) Decode ¶
func (this *BytesValueEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*BytesValueEncoder[T]) Encode ¶
func (this *BytesValueEncoder[T]) Encode(value T) ([]byte, error)
func (*BytesValueEncoder[T]) EncodeField ¶
func (this *BytesValueEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type CounterTable ¶
func NewCounterTable ¶
func NewCounterTable[T int64 | uint64](name string) (*CounterTable[T], error)
func (*CounterTable[T]) Increase ¶
func (this *CounterTable[T]) Increase(key string, delta T) (newValue T, err error)
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) AddTable ¶
func (this *DB) AddTable(table TableInterface)
type IntValueEncoder ¶
type IntValueEncoder[T constraints.Integer] struct { }
func NewIntValueEncoder ¶
func NewIntValueEncoder[T constraints.Integer]() *IntValueEncoder[T]
func (*IntValueEncoder[T]) Decode ¶
func (this *IntValueEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*IntValueEncoder[T]) Encode ¶
func (this *IntValueEncoder[T]) Encode(value T) (data []byte, err error)
func (*IntValueEncoder[T]) EncodeField ¶
func (this *IntValueEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type IteratorOptions ¶
func (*IteratorOptions) RawOptions ¶
func (this *IteratorOptions) RawOptions() *pebble.IterOptions
type NilValueEncoder ¶ added in v1.3.5
type NilValueEncoder[T []byte] struct { }
func NewNilValueEncoder ¶ added in v1.3.5
func NewNilValueEncoder[T []byte]() *NilValueEncoder[T]
func (*NilValueEncoder[T]) Decode ¶ added in v1.3.5
func (this *NilValueEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*NilValueEncoder[T]) Encode ¶ added in v1.3.5
func (this *NilValueEncoder[T]) Encode(value T) ([]byte, error)
func (*NilValueEncoder[T]) EncodeField ¶ added in v1.3.5
func (this *NilValueEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type Query ¶
type Query[T any] struct { // contains filtered or unexported fields }
func (*Query[T]) FieldOffset ¶
func (*Query[T]) FieldPrefix ¶
func (*Query[T]) FindAll ¶
func (this *Query[T]) FindAll(fn IteratorFunc[T]) (err error)
type QueryOperator ¶
type QueryOperator int
const ( QueryOperatorGt QueryOperator = 1 QueryOperatorGte QueryOperator = 2 QueryOperatorLt QueryOperator = 3 QueryOperatorLte QueryOperator = 4 )
type QueryOperatorInfo ¶
type QueryOperatorInfo struct { Operator QueryOperator Value any }
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func DefaultStore ¶ added in v1.3.5
type StringValueEncoder ¶
type StringValueEncoder[T string] struct { }
func NewStringValueEncoder ¶
func NewStringValueEncoder[T string]() *StringValueEncoder[T]
func (*StringValueEncoder[T]) Decode ¶
func (this *StringValueEncoder[T]) Decode(valueData []byte) (value T, err error)
func (*StringValueEncoder[T]) Encode ¶
func (this *StringValueEncoder[T]) Encode(value T) ([]byte, error)
func (*StringValueEncoder[T]) EncodeField ¶
func (this *StringValueEncoder[T]) EncodeField(value T, fieldName string) ([]byte, error)
type Table ¶
type Table[T any] struct { // contains filtered or unexported fields }
func (*Table[T]) ComposeFieldKey ¶
func (this *Table[T]) ComposeFieldKey(keyBytes []byte, fieldName string, fieldValueBytes []byte) []byte
ComposeFieldKey compose field key $Namespace$FieldName$FieldValueSeparatorKeyValueFieldLength[2]
func (*Table[T]) DecodeFieldKey ¶
func (*Table[T]) DeleteRange ¶ added in v1.3.5
func (*Table[T]) Encoder ¶ added in v1.3.5
func (this *Table[T]) Encoder() ValueEncoder[T]
func (*Table[T]) FullKeyBytes ¶
func (*Table[T]) SetNamespace ¶
type TableInterface ¶
type Tx ¶
type Tx[T any] struct { // contains filtered or unexported fields }
func (*Tx[T]) CommitSync ¶ added in v1.3.5
func (*Tx[T]) NewIterator ¶
func (this *Tx[T]) NewIterator(opt *IteratorOptions) (*pebble.Iterator, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.