Versions in this module Expand all Collapse all v0 v0.4.0 Jan 6, 2025 Changes in this version + var EmptyCondition = emptyCondition + 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 struct + ValueScanner ValueScanner[V] + func NewBasePersistence[V any, R any](writeDB *sql.DB, readDB *sql.DB, table string, readScanner readScanner[R], ...) *BasePersistence[V, R] + 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 interface + Params func() []any + ToString func(*int) string + type ConstCondition string + func (c ConstCondition) Params() []any + func (c ConstCondition) ToString(*int) string + type FieldName = string + type Interpreter interface + And func(conditions ...Condition) Condition + BetweenInts func(field FieldName, startKey, endKey int) Condition + BetweenStrings func(field FieldName, startKey, endKey string) Condition + Cmp func(field FieldName, symbol string, value any) Condition + In func(field FieldName, vals []any) Condition + InInts func(field FieldName, vals []int) Condition + InStrings func(field FieldName, vals []string) Condition + InTuple func(fields []FieldName, vals []Tuple) Condition + Or func(conditions ...Condition) Condition + type Opts struct + DataSource string + Driver SQLDriverType + MaxIdleConns int + MaxIdleTime time.Duration + MaxOpenConns int + SkipCreateTable bool + SkipPragmas bool + TablePrefix string + func GetOpts(config driver.Config, optsKey string) (*Opts, error) + type SQLDriverType string + type TableNameCreator struct + func NewTableNameCreator(prefix string) (*TableNameCreator, error) + func (c *TableNameCreator) GetTableName(name string) (string, bool) + func (c *TableNameCreator) MustGetTableName(name string) string + type Tuple = []any + type UnversionedPersistence struct + func NewUnversioned(readDB *sql.DB, writeDB *sql.DB, table string, ...) *UnversionedPersistence + func NewUnversionedPersistence(base driver.BasePersistence[driver.UnversionedValue, driver.UnversionedRead], ...) *UnversionedPersistence + func (db *UnversionedPersistence) CreateSchema() error + type ValueScanner interface + WriteValue func(V) []any + type VersionedPersistence struct + func NewVersioned(readDB *sql.DB, writeDB *sql.DB, table string, ...) *VersionedPersistence + func NewVersionedPersistence(base basePersistence[driver.VersionedValue, driver.VersionedRead], ...) *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 struct + func NewWriteTransaction(txn *sql.Tx, db versionedPersistence) *WriteTransaction + func (w *WriteTransaction) Commit() error + func (w *WriteTransaction) DeleteState(ns driver2.Namespace, key driver2.PKey) error + func (w *WriteTransaction) Discard() error + func (w *WriteTransaction) SetState(namespace driver2.Namespace, key driver2.PKey, value driver.VersionedValue) error