in_mem_table

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEntryNotFound = errors.New("cannot insert row; matching entry not found")

Functions

func Delete added in v0.17.0

func Delete[V any](ctx *sql.Context, ops *ValueOps[V], is IndexedSet[V], row sql.Row) error

func Insert added in v0.17.0

func Insert[V any](ctx *sql.Context, ops *ValueOps[V], is IndexedSet[V], row sql.Row) error

func MultiDelete added in v0.17.0

func MultiDelete[V any](ctx *sql.Context, ops *MultiValueOps[V], is IndexedSet[V], row sql.Row) error

func MultiInsert added in v0.17.0

func MultiInsert[V any](ctx *sql.Context, ops *MultiValueOps[V], is IndexedSet[V], row sql.Row) error

func MultiToRows added in v0.17.0

func MultiToRows[V any](ctx *sql.Context, ops *MultiValueOps[V], is IndexedSet[V]) ([]sql.Row, error)

func MultiUpdate added in v0.17.0

func MultiUpdate[V any](ctx *sql.Context, ops *MultiValueOps[V], is IndexedSet[V], old, new sql.Row) error

func ToRows added in v0.17.0

func ToRows[V any](ctx *sql.Context, ops *ValueOps[V], is IndexedSet[V]) ([]sql.Row, error)

func Update added in v0.17.0

func Update[V any](ctx *sql.Context, ops *ValueOps[V], is IndexedSet[V], old, new sql.Row) error

Types

type IndexedSet added in v0.17.0

type IndexedSet[V any] struct {
	Keyers  []Keyer[V]
	Indexes []MultiMap[V]
}

func NewIndexedSet added in v0.17.0

func NewIndexedSet[V any](eqf func(V, V) bool, keyers []Keyer[V]) IndexedSet[V]

func (IndexedSet[V]) Clear added in v0.17.0

func (is IndexedSet[V]) Clear()

func (IndexedSet[V]) Count added in v0.17.0

func (is IndexedSet[V]) Count() int

func (IndexedSet[V]) Get added in v0.17.0

func (is IndexedSet[V]) Get(v V) (V, bool)

func (IndexedSet[V]) GetMany added in v0.17.0

func (is IndexedSet[V]) GetMany(keyer Keyer[V], k any) []V

func (IndexedSet[V]) Put added in v0.17.0

func (is IndexedSet[V]) Put(v V)

func (IndexedSet[V]) Remove added in v0.17.0

func (is IndexedSet[V]) Remove(v V) (res V, found bool)

func (IndexedSet[V]) RemoveMany added in v0.17.0

func (is IndexedSet[V]) RemoveMany(keyer Keyer[V], k any)

func (IndexedSet[V]) VisitEntries added in v0.17.0

func (is IndexedSet[V]) VisitEntries(f func(v V))

type IndexedSetTable added in v0.17.0

type IndexedSetTable[V any] struct {
	// contains filtered or unexported fields
}

func NewIndexedSetTable added in v0.17.0

func NewIndexedSetTable[V any](name string, schema sql.Schema, coll sql.CollationID, set IndexedSet[V], ops ValueOps[V], lock, rlock sync.Locker) *IndexedSetTable[V]

func (*IndexedSetTable[V]) Collation added in v0.17.0

func (t *IndexedSetTable[V]) Collation() sql.CollationID

func (*IndexedSetTable[V]) Deleter added in v0.17.0

func (t *IndexedSetTable[V]) Deleter(ctx *sql.Context) sql.RowDeleter

func (*IndexedSetTable[V]) Editor added in v0.17.0

func (t *IndexedSetTable[V]) Editor() editor

func (*IndexedSetTable[V]) Inserter added in v0.17.0

func (t *IndexedSetTable[V]) Inserter(ctx *sql.Context) sql.RowInserter

func (*IndexedSetTable[V]) Name added in v0.17.0

func (t *IndexedSetTable[V]) Name() string

func (*IndexedSetTable[V]) PartitionRows added in v0.17.0

func (t *IndexedSetTable[V]) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)

func (*IndexedSetTable[V]) Partitions added in v0.17.0

func (t *IndexedSetTable[V]) Partitions(ctx *sql.Context) (sql.PartitionIter, error)

func (*IndexedSetTable[V]) Replacer added in v0.17.0

func (t *IndexedSetTable[V]) Replacer(ctx *sql.Context) sql.RowReplacer

func (*IndexedSetTable[V]) Schema added in v0.17.0

func (t *IndexedSetTable[V]) Schema() sql.Schema

func (*IndexedSetTable[V]) Set added in v0.17.0

func (t *IndexedSetTable[V]) Set() IndexedSet[V]

func (*IndexedSetTable[V]) String added in v0.17.0

func (t *IndexedSetTable[V]) String() string

func (*IndexedSetTable[V]) TableId added in v0.18.0

func (t *IndexedSetTable[V]) TableId() sql.TableId

func (*IndexedSetTable[V]) Truncate added in v0.17.0

func (t *IndexedSetTable[V]) Truncate(ctx *sql.Context) (int, error)

func (*IndexedSetTable[V]) Updater added in v0.17.0

func (t *IndexedSetTable[V]) Updater(ctx *sql.Context) sql.RowUpdater

type IndexedSetTableEditor added in v0.17.0

type IndexedSetTableEditor[V any] struct {
	Set IndexedSet[V]
	Ops ValueOps[V]
}

func (*IndexedSetTableEditor[V]) Close added in v0.17.0

func (e *IndexedSetTableEditor[V]) Close(ctx *sql.Context) error

func (*IndexedSetTableEditor[V]) Delete added in v0.17.0

func (e *IndexedSetTableEditor[V]) Delete(ctx *sql.Context, row sql.Row) error

func (*IndexedSetTableEditor[V]) DiscardChanges added in v0.17.0

func (e *IndexedSetTableEditor[V]) DiscardChanges(ctx *sql.Context, cause error) error

func (*IndexedSetTableEditor[V]) Insert added in v0.17.0

func (e *IndexedSetTableEditor[V]) Insert(ctx *sql.Context, row sql.Row) error

func (*IndexedSetTableEditor[V]) StatementBegin added in v0.17.0

func (e *IndexedSetTableEditor[V]) StatementBegin(ctx *sql.Context)

func (*IndexedSetTableEditor[V]) StatementComplete added in v0.17.0

func (e *IndexedSetTableEditor[V]) StatementComplete(ctx *sql.Context) error

func (*IndexedSetTableEditor[V]) Update added in v0.17.0

func (e *IndexedSetTableEditor[V]) Update(ctx *sql.Context, old, new sql.Row) error

type Keyer added in v0.17.0

type Keyer[V any] interface {
	GetKey(V) any
}

type MultiIndexedSetTable added in v0.17.0

type MultiIndexedSetTable[V any] struct {
	// contains filtered or unexported fields
}

func NewMultiIndexedSetTable added in v0.17.0

func NewMultiIndexedSetTable[V any](name string, schema sql.Schema, coll sql.CollationID, set IndexedSet[V], ops MultiValueOps[V], lock, rlock sync.Locker) *MultiIndexedSetTable[V]

func (*MultiIndexedSetTable[V]) Collation added in v0.17.0

func (t *MultiIndexedSetTable[V]) Collation() sql.CollationID

func (*MultiIndexedSetTable[V]) Deleter added in v0.17.0

func (t *MultiIndexedSetTable[V]) Deleter(ctx *sql.Context) sql.RowDeleter

func (*MultiIndexedSetTable[V]) Editor added in v0.17.0

func (t *MultiIndexedSetTable[V]) Editor() editor

func (*MultiIndexedSetTable[V]) Inserter added in v0.17.0

func (t *MultiIndexedSetTable[V]) Inserter(ctx *sql.Context) sql.RowInserter

func (*MultiIndexedSetTable[V]) Name added in v0.17.0

func (t *MultiIndexedSetTable[V]) Name() string

func (*MultiIndexedSetTable[V]) PartitionRows added in v0.17.0

func (t *MultiIndexedSetTable[V]) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)

func (*MultiIndexedSetTable[V]) Partitions added in v0.17.0

func (t *MultiIndexedSetTable[V]) Partitions(ctx *sql.Context) (sql.PartitionIter, error)

func (*MultiIndexedSetTable[V]) Replacer added in v0.17.0

func (t *MultiIndexedSetTable[V]) Replacer(ctx *sql.Context) sql.RowReplacer

func (*MultiIndexedSetTable[V]) Schema added in v0.17.0

func (t *MultiIndexedSetTable[V]) Schema() sql.Schema

func (*MultiIndexedSetTable[V]) Set added in v0.17.0

func (t *MultiIndexedSetTable[V]) Set() IndexedSet[V]

func (*MultiIndexedSetTable[V]) String added in v0.17.0

func (t *MultiIndexedSetTable[V]) String() string

func (*MultiIndexedSetTable[V]) Updater added in v0.17.0

func (t *MultiIndexedSetTable[V]) Updater(ctx *sql.Context) sql.RowUpdater

type MultiIndexedSetTableEditor added in v0.17.0

type MultiIndexedSetTableEditor[V any] struct {
	Set IndexedSet[V]
	Ops MultiValueOps[V]
}

func (*MultiIndexedSetTableEditor[V]) Close added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) Close(ctx *sql.Context) error

func (*MultiIndexedSetTableEditor[V]) Delete added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) Delete(ctx *sql.Context, row sql.Row) error

func (*MultiIndexedSetTableEditor[V]) DiscardChanges added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) DiscardChanges(ctx *sql.Context, cause error) error

func (*MultiIndexedSetTableEditor[V]) Insert added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) Insert(ctx *sql.Context, row sql.Row) error

func (*MultiIndexedSetTableEditor[V]) StatementBegin added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) StatementBegin(ctx *sql.Context)

func (*MultiIndexedSetTableEditor[V]) StatementComplete added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) StatementComplete(ctx *sql.Context) error

func (*MultiIndexedSetTableEditor[V]) Update added in v0.17.0

func (e *MultiIndexedSetTableEditor[V]) Update(ctx *sql.Context, old, new sql.Row) error

type MultiMap added in v0.17.0

type MultiMap[V any] struct {
	Equals func(v1, v2 V) bool
	// contains filtered or unexported fields
}

func NewMultiMap added in v0.17.0

func NewMultiMap[V any](f func(v1, v2 V) bool) MultiMap[V]

func (MultiMap[V]) Clear added in v0.17.0

func (m MultiMap[V]) Clear()

func (MultiMap[V]) Get added in v0.17.0

func (m MultiMap[V]) Get(k any, v V) (res V, found bool)

func (MultiMap[V]) GetMany added in v0.17.0

func (m MultiMap[V]) GetMany(k any) []V

func (MultiMap[V]) Put added in v0.17.0

func (m MultiMap[V]) Put(k any, v V)

func (MultiMap[V]) Remove added in v0.17.0

func (m MultiMap[V]) Remove(k any, v V) (res V, found bool)

func (MultiMap[V]) VisitEntries added in v0.17.0

func (m MultiMap[V]) VisitEntries(f func(v V))

type MultiValueOps added in v0.17.0

type MultiValueOps[V any] struct {
	ToRows    func(*sql.Context, V) ([]sql.Row, error)
	FromRow   func(*sql.Context, sql.Row) (V, error)
	AddRow    func(*sql.Context, sql.Row, V) (V, error)
	DeleteRow func(*sql.Context, sql.Row, V) (V, error)
}

type OperationLockingTableEditor added in v0.17.0

type OperationLockingTableEditor struct {
	L sync.Locker
	E sql.TableEditor
}

func (OperationLockingTableEditor) Close added in v0.17.0

Close implements the sql.Closer interface.

func (OperationLockingTableEditor) Delete added in v0.17.0

func (e OperationLockingTableEditor) Delete(ctx *sql.Context, row sql.Row) error

Delete implements the sql.RowDeleter interface.

func (OperationLockingTableEditor) DiscardChanges added in v0.17.0

func (e OperationLockingTableEditor) DiscardChanges(ctx *sql.Context, errorEncountered error) error

DiscardChanges implements the sql.TableEditor interface.

func (OperationLockingTableEditor) Insert added in v0.17.0

func (e OperationLockingTableEditor) Insert(ctx *sql.Context, row sql.Row) error

Insert implements the sql.RowInserter interface.

func (OperationLockingTableEditor) StatementBegin added in v0.17.0

func (e OperationLockingTableEditor) StatementBegin(ctx *sql.Context)

StatementBegin implements the sql.TableEditor interface.

func (OperationLockingTableEditor) StatementComplete added in v0.17.0

func (e OperationLockingTableEditor) StatementComplete(ctx *sql.Context) error

OperationComplete implements the sql.TableEditor interface.

func (OperationLockingTableEditor) Update added in v0.17.0

func (e OperationLockingTableEditor) Update(ctx *sql.Context, old sql.Row, new sql.Row) error

Update implements the sql.RowUpdater interface.

type StatementLockingTableEditor added in v0.17.0

type StatementLockingTableEditor struct {
	L sync.Locker
	E sql.TableEditor
}

func (StatementLockingTableEditor) Close added in v0.17.0

Close implements the sql.Closer interface.

func (StatementLockingTableEditor) Delete added in v0.17.0

func (e StatementLockingTableEditor) Delete(ctx *sql.Context, row sql.Row) error

Delete implements the sql.RowDeleter interface.

func (StatementLockingTableEditor) DiscardChanges added in v0.17.0

func (e StatementLockingTableEditor) DiscardChanges(ctx *sql.Context, errorEncountered error) error

DiscardChanges implements the sql.TableEditor interface.

func (StatementLockingTableEditor) Insert added in v0.17.0

func (e StatementLockingTableEditor) Insert(ctx *sql.Context, row sql.Row) error

Insert implements the sql.RowInserter interface.

func (StatementLockingTableEditor) StatementBegin added in v0.17.0

func (e StatementLockingTableEditor) StatementBegin(ctx *sql.Context)

StatementBegin implements the sql.TableEditor interface.

func (StatementLockingTableEditor) StatementComplete added in v0.17.0

func (e StatementLockingTableEditor) StatementComplete(ctx *sql.Context) error

StatementComplete implements the sql.TableEditor interface.

func (StatementLockingTableEditor) Update added in v0.17.0

func (e StatementLockingTableEditor) Update(ctx *sql.Context, old sql.Row, new sql.Row) error

Update implements the sql.RowUpdater interface.

type ValueOps added in v0.17.0

type ValueOps[V any] struct {
	ToRow         func(*sql.Context, V) (sql.Row, error)
	FromRow       func(*sql.Context, sql.Row) (V, error)
	UpdateWithRow func(*sql.Context, sql.Row, V) (V, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL