mock

package
v0.0.0-...-406b1e7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangesList

type ChangesList = []map[typeddb.EID]typeddb.Change

ChangesList is an array of changes to a db. Each change consist of a map between a changed entity ID and the change

type DBReadOnly

type DBReadOnly struct {
	DB *typeddb.TypedDB
}

DBReadOnly is a read-only typeddb to be use in unittests

func (*DBReadOnly) Snapshot

func (mDB *DBReadOnly) Snapshot() limestone.Snapshot

Snapshot returns the DB current state

func (*DBReadOnly) WaitReady

func (mDB *DBReadOnly) WaitReady(ctx context.Context) error

WaitReady succeeds immediately (the mock database is always ready)

type DBReadWrite

type DBReadWrite struct {
	DBReadOnly
	// contains filtered or unexported fields
}

DBReadWrite is a DBReadWrite typeddb to be use in unittests

func NewDBReadWrite

func NewDBReadWrite(db *typeddb.TypedDB) *DBReadWrite

NewDBReadWrite returns new instance of DBReadWrite

func (*DBReadWrite) Changes

func (pDB *DBReadWrite) Changes() ChangesList

Changes returns the DB changes list

func (*DBReadWrite) Do

func (pDB *DBReadWrite) Do(fn func(txn limestone.Transaction))

Do executes the function on the transaction and saves the changes

func (*DBReadWrite) DoE

func (pDB *DBReadWrite) DoE(fn func(txn limestone.Transaction) error) error

DoE executes the function on the transaction and saves the changes

func (*DBReadWrite) Snapshot

func (pDB *DBReadWrite) Snapshot() limestone.Snapshot

Snapshot returns the DB current state

Jump to

Keyboard shortcuts

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