in_memory

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 9 Imported by: 0

README

in_memory

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyElemsList            = errors.New("elements list in method argument cannot be nil or empty")
	ErrEmptyModifier             = errors.New("modifier in method argument cannot be nil")
	ErrElemNotFound              = errors.New("queried element not found")
	ErrNotAllowedOutsideExecutor = errors.New("queries are not allowed outside executor")
)

Functions

This section is empty.

Types

type Collection

type Collection[T any] struct {
	// contains filtered or unexported fields
}

func (*Collection[T]) Delete

func (c *Collection[T]) Delete(ctx context.Context, ids []ObjectID) error

func (*Collection[T]) Insert

func (c *Collection[T]) Insert(ctx context.Context, elems []T) ([]ObjectID, error)

func (*Collection[T]) Select

func (c *Collection[T]) Select(ctx context.Context, filter func(elem T) bool) (map[ObjectID]T, error)

func (*Collection[T]) SelectByIDs

func (c *Collection[T]) SelectByIDs(ctx context.Context, ids []ObjectID) (map[ObjectID]T, error)

func (*Collection[T]) Update added in v0.0.6

func (c *Collection[T]) Update(ctx context.Context, elems map[ObjectID]T) error

func (*Collection[T]) UpdateByIDs

func (c *Collection[T]) UpdateByIDs(ctx context.Context, ids []ObjectID, modifier func(elem T) T) error

type CollectionsList

type CollectionsList struct {
	Orders           Collection[collections.Order]
	RoomAvailability Collection[collections.RoomAvailability]
}

type InMemoryConnection

type InMemoryConnection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(timeoutMs uint) *InMemoryConnection

func (*InMemoryConnection) Collections

func (c *InMemoryConnection) Collections() *CollectionsList

func (*InMemoryConnection) Execute

func (c *InMemoryConnection) Execute(ctx context.Context, lockerList []Locker, fArgs ...TransactionBodyFunc) error

func (*InMemoryConnection) GenerateQueryID

func (c *InMemoryConnection) GenerateQueryID() uint64

type Locker added in v0.0.4

type Locker interface {
	// contains filtered or unexported methods
}

type ObjectID added in v0.0.5

type ObjectID uint64

type TransactionBodyFunc

type TransactionBodyFunc func(ctx context.Context, collectionsList *CollectionsList) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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