Documentation
¶
Index ¶
- Variables
- type Collection
- func (c *Collection[T]) Delete(ctx context.Context, ids []ObjectID) error
- func (c *Collection[T]) Insert(ctx context.Context, elems []T) ([]ObjectID, error)
- func (c *Collection[T]) Select(ctx context.Context, filter func(elem T) bool) (map[ObjectID]T, error)
- func (c *Collection[T]) SelectByIDs(ctx context.Context, ids []ObjectID) (map[ObjectID]T, error)
- func (c *Collection[T]) Update(ctx context.Context, elems map[ObjectID]T) error
- func (c *Collection[T]) UpdateByIDs(ctx context.Context, ids []ObjectID, modifier func(elem T) T) error
- type CollectionsList
- type InMemoryConnection
- type Locker
- type ObjectID
- type TransactionBodyFunc
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]) SelectByIDs ¶
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 TransactionBodyFunc ¶
type TransactionBodyFunc func(ctx context.Context, collectionsList *CollectionsList) error
Click to show internal directories.
Click to hide internal directories.