minos.aggregate.events.repositories.database.factories

Classes

EventDatabaseOperationFactory

Event Database Operation Factory base class.

class EventDatabaseOperationFactory[source]

Bases: DatabaseOperationFactory, ABC

Event Database Operation Factory base class.

abstract build_create()[source]

Build the database operation to create the event table.

Returns

A DatabaseOperation instance.s

Return type

DatabaseOperation

abstract build_submit(transaction_uuids, uuid, action, name, version, data, created_at, transaction_uuid, lock, **kwargs)[source]

Build the database operation to submit a row into the event table.

Parameters
  • transaction_uuids (Iterable[UUID]) – The sequence of nested transaction in on top of the current event’s transaction.

  • uuid (UUID) – The identifier of the entity.

  • action (Action) – The action of the event.

  • name (str) – The name of the entity.

  • version (int) – The version of the entity

  • data (bytes) – The data of the event.

  • created_at (datetime) – The creation datetime.

  • transaction_uuid (UUID) – The identifier of the transaction.

  • lock (Optional[int]) – The lock identifier.

  • kwargs – Additional named arguments.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_query(uuid=None, name=None, version=None, version_lt=None, version_gt=None, version_le=None, version_ge=None, id=None, id_lt=None, id_gt=None, id_le=None, id_ge=None, transaction_uuid=None, transaction_uuid_ne=None, transaction_uuid_in=None, **kwargs)[source]

Build the database operation to select rows.

Parameters
  • uuid (Optional[UUID]) – The identifier must be equal to the given value.

  • name (Optional[str]) – The classname must be equal to the given value.

  • version (Optional[int]) – The version must be equal to the given value.

  • version_lt (Optional[int]) – The version must be lower than the given value.

  • version_gt (Optional[int]) – The version must be greater than the given value.

  • version_le (Optional[int]) – The version must be lower or equal to the given value.

  • version_ge (Optional[int]) – The version must be greater or equal to the given value.

  • id (Optional[int]) – The entry identifier must be equal to the given value.

  • id_lt (Optional[int]) – The entry identifier must be lower than the given value.

  • id_gt (Optional[int]) – The entry identifier must be greater than the given value.

  • id_le (Optional[int]) – The entry identifier must be lower or equal to the given value.

  • id_ge (Optional[int]) – The entry identifier must be greater or equal to the given value.

  • transaction_uuid (Optional[UUID]) – The transaction identifier must be equal to the given value.

  • transaction_uuid_ne (Optional[UUID]) – The transaction identifier must be distinct of the given value.

  • transaction_uuid_in (Optional[tuple[uuid.UUID, ...]]) – The destination transaction identifier must be equal to one of the given values.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_query_offset()[source]

Build the database operation to get the maximum identifier.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation