Documentation ¶
Index ¶
- Variables
- func CreateParamsMatrix(fields, rows int, offset int) string
- func InitSchema(db *sql.DB, schemas ...string) (err error)
- func JoinCol(tableName string, field FieldName) string
- func NewInterpreter() *interpreter
- func NewUnversionedReadScanner() *unversionedReadScanner
- func NewUnversionedValueScanner() *unversionedValueScanner
- func NewVersionedMetadataValueScanner() *versionedMetadataValueScanner
- func NewVersionedReadScanner() *versionedReadScanner
- func NewVersionedValueScanner() *versionedValueScanner
- func TestCases(t *testing.T, ...)
- func ToInts[T constraints.Integer](in []T) []int
- func Where(c Condition) (string, []any)
- type BasePersistence
- func (db *BasePersistence[V, R]) Close() error
- func (db *BasePersistence[V, R]) DeleteState(ns driver2.Namespace, key driver2.PKey) error
- func (db *BasePersistence[V, R]) DeleteStateWithTx(tx *sql.Tx, ns driver2.Namespace, key driver2.PKey) error
- func (db *BasePersistence[V, R]) DeleteStates(namespace driver2.Namespace, keys ...driver2.PKey) map[driver2.PKey]error
- func (db *BasePersistence[V, R]) DeleteStatesWithTx(tx *sql.Tx, namespace driver2.Namespace, keys ...driver2.PKey) map[driver2.PKey]error
- func (db *BasePersistence[V, R]) Exec(query string, args ...any) (sql.Result, error)
- func (db *BasePersistence[V, R]) Exists(ns driver2.Namespace, key driver2.PKey) (bool, error)
- func (db *BasePersistence[V, R]) GetState(namespace driver2.Namespace, key string) (V, error)
- func (db *BasePersistence[V, R]) GetStateRangeScanIterator(ns driver2.Namespace, startKey, endKey string) (collections.Iterator[*R], error)
- func (db *BasePersistence[V, R]) GetStateSetIterator(ns driver2.Namespace, keys ...driver2.PKey) (collections.Iterator[*R], error)
- func (db *BasePersistence[V, R]) InitSchema(query string) error
- func (db *BasePersistence[V, R]) SetState(ns driver2.Namespace, pkey driver2.PKey, value V) error
- func (db *BasePersistence[V, R]) SetStateWithTx(tx *sql.Tx, ns driver2.Namespace, pkey string, value V) error
- func (db *BasePersistence[V, R]) SetStates(ns driver2.Namespace, kvs map[driver2.PKey]V) map[driver2.PKey]error
- func (db *BasePersistence[V, R]) Stats() any
- func (db *BasePersistence[V, R]) TableName() string
- func (db *BasePersistence[V, R]) UpsertStateWithTx(tx *sql.Tx, ns driver2.Namespace, pkey driver2.PKey, keys []string, ...) error
- func (db *BasePersistence[V, R]) UpsertStates(ns driver2.Namespace, valueKeys []string, vals map[driver2.PKey][]any) map[driver2.PKey]error
- type Condition
- type ConstCondition
- type FieldName
- type Interpreter
- type Opts
- type SQLDriverType
- type TableNameCreator
- type Tuple
- type UnversionedPersistence
- type ValueScanner
- type VersionedPersistence
- func (db *VersionedPersistence) CreateSchema() error
- func (db *VersionedPersistence) GetStateMetadata(namespace driver2.Namespace, key driver2.PKey) (driver2.Metadata, driver2.RawVersion, error)
- func (db *VersionedPersistence) NewWriteTransaction() (driver.WriteTransaction, error)
- func (db *VersionedPersistence) SetStateMetadata(ns driver2.Namespace, key driver2.PKey, metadata driver2.Metadata, ...) error
- func (db *VersionedPersistence) SetStateMetadatas(ns driver2.Namespace, kvs map[driver2.PKey]driver2.VersionedMetadataValue) map[driver2.PKey]error
- func (db *VersionedPersistence) Stats() any
- type WriteTransaction
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyCondition = emptyCondition{}
Functions ¶
func CreateParamsMatrix ¶
func NewInterpreter ¶
func NewInterpreter() *interpreter
func NewUnversionedReadScanner ¶
func NewUnversionedReadScanner() *unversionedReadScanner
func NewUnversionedValueScanner ¶
func NewUnversionedValueScanner() *unversionedValueScanner
func NewVersionedMetadataValueScanner ¶
func NewVersionedMetadataValueScanner() *versionedMetadataValueScanner
func NewVersionedReadScanner ¶
func NewVersionedReadScanner() *versionedReadScanner
func NewVersionedValueScanner ¶
func NewVersionedValueScanner() *versionedValueScanner
func TestCases ¶
func TestCases(t *testing.T, versionedProvider provider[driver.TransactionalVersionedPersistence], unversionedProvider provider[driver.UnversionedPersistence], unversionedNotifierProvider provider[driver.UnversionedNotifier], versionedNotifierProvider provider[driver.VersionedNotifier], baseUnpacker func(p driver.UnversionedPersistence) *BasePersistence[driver.UnversionedValue, driver.UnversionedRead])
func ToInts ¶
func ToInts[T constraints.Integer](in []T) []int
Types ¶
type BasePersistence ¶
type BasePersistence[V any, R any] struct { *common.BaseDB[*sql.Tx] ValueScanner ValueScanner[V] // contains filtered or unexported fields }
func NewBasePersistence ¶
func NewBasePersistence[V any, R any](writeDB *sql.DB, readDB *sql.DB, table string, readScanner readScanner[R], valueScanner ValueScanner[V], errorWrapper driver.SQLErrorWrapper, ci Interpreter, newTransaction func() (*sql.Tx, error)) *BasePersistence[V, R]
func (*BasePersistence[V, R]) Close ¶
func (db *BasePersistence[V, R]) Close() error
func (*BasePersistence[V, R]) DeleteState ¶
func (*BasePersistence[V, R]) DeleteStateWithTx ¶
func (*BasePersistence[V, R]) DeleteStates ¶
func (*BasePersistence[V, R]) DeleteStatesWithTx ¶
func (*BasePersistence[V, R]) GetState ¶
func (db *BasePersistence[V, R]) GetState(namespace driver2.Namespace, key string) (V, error)
func (*BasePersistence[V, R]) GetStateRangeScanIterator ¶
func (db *BasePersistence[V, R]) GetStateRangeScanIterator(ns driver2.Namespace, startKey, endKey string) (collections.Iterator[*R], error)
func (*BasePersistence[V, R]) GetStateSetIterator ¶
func (db *BasePersistence[V, R]) GetStateSetIterator(ns driver2.Namespace, keys ...driver2.PKey) (collections.Iterator[*R], error)
func (*BasePersistence[V, R]) InitSchema ¶
func (db *BasePersistence[V, R]) InitSchema(query string) error
func (*BasePersistence[V, R]) SetStateWithTx ¶
func (*BasePersistence[V, R]) Stats ¶
func (db *BasePersistence[V, R]) Stats() any
func (*BasePersistence[V, R]) TableName ¶
func (db *BasePersistence[V, R]) TableName() string
func (*BasePersistence[V, R]) UpsertStateWithTx ¶
type ConstCondition ¶
type ConstCondition string
func (ConstCondition) Params ¶
func (c ConstCondition) Params() []any
func (ConstCondition) ToString ¶
func (c ConstCondition) ToString(*int) string
type Interpreter ¶
type Interpreter interface { Cmp(field FieldName, symbol string, value any) Condition And(conditions ...Condition) Condition Or(conditions ...Condition) Condition In(field FieldName, vals []any) Condition InStrings(field FieldName, vals []string) Condition InInts(field FieldName, vals []int) Condition InTuple(fields []FieldName, vals []Tuple) Condition BetweenStrings(field FieldName, startKey, endKey string) Condition BetweenInts(field FieldName, startKey, endKey int) Condition }
type Opts ¶
type SQLDriverType ¶
type SQLDriverType string
type TableNameCreator ¶
type TableNameCreator struct {
// contains filtered or unexported fields
}
func NewTableNameCreator ¶
func NewTableNameCreator(prefix string) (*TableNameCreator, error)
func (*TableNameCreator) GetTableName ¶
func (c *TableNameCreator) GetTableName(name string) (string, bool)
func (*TableNameCreator) MustGetTableName ¶
func (c *TableNameCreator) MustGetTableName(name string) string
type UnversionedPersistence ¶
type UnversionedPersistence struct { driver.BasePersistence[driver.UnversionedValue, driver.UnversionedRead] // contains filtered or unexported fields }
func NewUnversioned ¶
func NewUnversioned(readDB *sql.DB, writeDB *sql.DB, table string, errorWrapper driver.SQLErrorWrapper, ci Interpreter) *UnversionedPersistence
func NewUnversionedPersistence ¶
func NewUnversionedPersistence(base driver.BasePersistence[driver.UnversionedValue, driver.UnversionedRead], writeDB *sql.DB, table string) *UnversionedPersistence
func (*UnversionedPersistence) CreateSchema ¶
func (db *UnversionedPersistence) CreateSchema() error
type ValueScanner ¶
type VersionedPersistence ¶
type VersionedPersistence struct {
// contains filtered or unexported fields
}
func NewVersioned ¶
func NewVersioned(readDB *sql.DB, writeDB *sql.DB, table string, errorWrapper driver.SQLErrorWrapper, ci Interpreter) *VersionedPersistence
func NewVersionedPersistence ¶
func NewVersionedPersistence(base basePersistence[driver.VersionedValue, driver.VersionedRead], table string, errorWrapper driver.SQLErrorWrapper, readDB *sql.DB, writeDB *sql.DB) *VersionedPersistence
func (*VersionedPersistence) CreateSchema ¶
func (db *VersionedPersistence) CreateSchema() error
func (*VersionedPersistence) GetStateMetadata ¶
func (db *VersionedPersistence) GetStateMetadata(namespace driver2.Namespace, key driver2.PKey) (driver2.Metadata, driver2.RawVersion, error)
func (*VersionedPersistence) NewWriteTransaction ¶
func (db *VersionedPersistence) NewWriteTransaction() (driver.WriteTransaction, error)
func (*VersionedPersistence) SetStateMetadata ¶
func (db *VersionedPersistence) SetStateMetadata(ns driver2.Namespace, key driver2.PKey, metadata driver2.Metadata, version driver2.RawVersion) error
func (*VersionedPersistence) SetStateMetadatas ¶
func (db *VersionedPersistence) SetStateMetadatas(ns driver2.Namespace, kvs map[driver2.PKey]driver2.VersionedMetadataValue) map[driver2.PKey]error
func (*VersionedPersistence) Stats ¶
func (db *VersionedPersistence) Stats() any
type WriteTransaction ¶
type WriteTransaction struct {
// contains filtered or unexported fields
}
func NewWriteTransaction ¶
func NewWriteTransaction(txn *sql.Tx, db versionedPersistence) *WriteTransaction
func (*WriteTransaction) Commit ¶
func (w *WriteTransaction) Commit() error
func (*WriteTransaction) DeleteState ¶
func (*WriteTransaction) Discard ¶
func (w *WriteTransaction) Discard() error
func (*WriteTransaction) SetState ¶
func (w *WriteTransaction) SetState(namespace driver2.Namespace, key driver2.PKey, value driver.VersionedValue) error
Click to show internal directories.
Click to hide internal directories.