bovid.aggregates.smoke.repo module

class bovid.aggregates.smoke.repo.SmokeRecord

Bases: Model

smoke_id: int
value: Smoke
__init__(smoke_id, value)

Method generated by attrs for class SmokeRecord.

Parameters:
Return type:

None

class bovid.aggregates.smoke.repo.SmokeRepoProtocol

Bases: RepoProtocol[Smoke], Protocol

class bovid.aggregates.smoke.repo.SmokeRepoFake

Bases: SmokeRepoProtocol, RepoFake[Smoke]

class bovid.aggregates.smoke.repo.SmokeRepoSQL

Bases: SmokeRepoProtocol

__init__(conn)
Parameters:

conn (Connection)

Return type:

None

conn: Connection
commit()
Return type:

None

rollback()
Return type:

None

close()
Return type:

None

create(smoke)

Create a new entity.

If an entity exists that matches this entity no new entity is created and the existing ID is returned. There is a return value that reports if this was the case.

Parameters:
  • agg – The domain model object to add to the repository.

  • smoke (Smoke)

Returns:

The ID of model in storage (can be new or old ID) already_exists: True if entity already existed.

Return type:

id

See also

If you want to in-place replace an existing entity but keep the same ID use the replace method if available.

If you want to update some fields of an entity see the update method.

list()

List all aggregates.

Returns:

list of tuples of (aggregate_id, aggregate)

Return type:

aggregates

retrieve(smoke_id)

Get an entity by reference.

Parameters:
  • id – The ID of model to retrieve.

  • smoke_id (int)

Returns:

The ID of model retrieved. agg: The domain model object to add to the repository.

Return type:

id

replace(smoke_id, smoke)

Get an entity by reference.

Parameters:
  • id – The ID of model to retrieve.

  • agg – The domain model object to add to the repository.

  • smoke_id (int)

  • smoke (Smoke)

Returns:

Reports if replacement was successful.

Return type:

success

See also

See the update method if just want to update some specific parts of the model with a patch.

update(smoke_id, patch)

Partial update of an aggregate.

Parameters:
  • agg_id – Reference of Aggregate you want to update.

  • patch (Mapping[Hashable, Any]) – An unstructured and partial version of the Aggregate. These values will replace the current ones in the stored Aggregate.

  • smoke_id (int)

Returns:

If Aggregate exists the patched version, otherwise None. success: Whether the actual write operation of the patched Aggregate succeeded.

Return type:

maybe_model

See also

See the replace method if you want to replace the entire model and not just a diff.

delete(smoke_ids)

Delete aggregates.

Parameters:
  • agg_ids – The IDs of aggregates to delete

  • smoke_ids (Sequence[int])

Returns:

success

Return type:

bool

class bovid.aggregates.smoke.repo.SmokeUnitOfWork

Bases: UnitOfWorkProtocol[BovidServerState, Smoke]

repo: SmokeRepoSQL | SmokeRepoFake
commit()
Return type:

None

rollback()
Return type:

None

__init__(repo)

Method generated by attrs for class SmokeUnitOfWork.

Parameters:

repo (SmokeRepoSQL | SmokeRepoFake)

Return type:

None