loom.core.use_case.markers

Functions

Exists(entity_type, *[, from_param, ...])

Factory returning marker for boolean existence checks.

Input()

Factory returning the runtime marker for command payload parameters.

Load(entity_type, *[, from_param, ...])

Factory returning marker for preloaded entity parameters by field.

LoadById(entity_type, *[, by, profile, ...])

Factory returning marker for preloaded entity parameters by id.

Classes

LookupKind(value)

Lookup strategy used by marker-driven prefetch.

OnMissing(value)

Policy applied when a marker lookup does not resolve an entity.

SourceKind(value)

Origin of a lookup value used by Load/Exists markers.

_ExistsMarker(entity_type, *, from_kind, ...)

Marks a parameter as a boolean existence check.

_InputMarker()

Marks a parameter as the command payload input.

_LoadByIdMarker(entity_type, *[, by, ...])

Marks a parameter as a prefetched entity loaded by id.

_LoadMarker(entity_type, *, from_kind, ...)

Marks a parameter as a prefetched entity loaded by an arbitrary field.

class loom.core.use_case.markers.SourceKind(value)[source]

Bases: StrEnum

Origin of a lookup value used by Load/Exists markers.

class loom.core.use_case.markers.LookupKind(value)[source]

Bases: StrEnum

Lookup strategy used by marker-driven prefetch.

class loom.core.use_case.markers.OnMissing(value)[source]

Bases: StrEnum

Policy applied when a marker lookup does not resolve an entity.

loom.core.use_case.markers.Input()[source]

Factory returning the runtime marker for command payload parameters.

Returned value is intentionally typed as Any in overloads to avoid mypy default-argument incompatibility in signatures like: cmd: Command = Input().

Return type:

Any

loom.core.use_case.markers.LoadById(entity_type, *, by='id', profile='default', on_missing=OnMissing.RAISE)[source]

Factory returning marker for preloaded entity parameters by id.

Returned value is intentionally typed as Any in overloads to avoid mypy default-argument incompatibility in signatures like: entity: User = LoadById(User, by="id").

Parameters:
  • entity_type (type[EntityT]) – Domain entity type the repository should load.

  • by (str) – Name of the primitive parameter used as the lookup key. Defaults to "id".

  • profile (str) – Loading profile forwarded to repo.get_by_id. Defaults to "default".

  • on_missing (OnMissing) – Missing-entity policy. Defaults to OnMissing.RAISE.

Return type:

Any

loom.core.use_case.markers.Load(entity_type, *, from_param=None, from_command=None, against, profile='default', on_missing=OnMissing.RAISE)[source]

Factory returning marker for preloaded entity parameters by field.

Parameters:
  • entity_type (type[EntityT])

  • from_param (str | None)

  • from_command (str | None)

  • against (str)

  • profile (str)

  • on_missing (OnMissing)

Return type:

Any

loom.core.use_case.markers.Exists(entity_type, *, from_param=None, from_command=None, against, on_missing=OnMissing.RETURN_FALSE)[source]

Factory returning marker for boolean existence checks.

Parameters:
  • entity_type (type[EntityT])

  • from_param (str | None)

  • from_command (str | None)

  • against (str)

  • on_missing (OnMissing)

Return type:

Any