betty.datas.aggregate.record package#
Submodules#
Module contents#
Record data types.
- final class betty.datas.aggregate.record.FieldDefinition#
Bases:
GenericA record field definition.
- __init__(data: ResolvableDataDefinition[Intersection[DataDefinitionT, DataDefinition[DataT]]], *, label: ResolvableLocalizable | None = None, description: ResolvableLocalizable | None = None, optional: bool = False, porter: ResolvableFieldDefinitionFeature[Intersection[FieldPorterT, FieldPorter[OwnerT, DataT]], OwnerT, DataT] | None = None)#
- data: Final[DataDefinitionT]#
The field’s data definition.
- description: Final[Localizable | None]#
The human-readable long field description.
- label: Final[Localizable]#
The human-readable field label.
- property porter: Intersection[FieldPorterT, FieldPorter[OwnerT, DataT]]#
The porter for the data.
- Raises:
- try_porter: Final[Intersection[FieldPorterT, FieldPorter[OwnerT, DataT]] | None]#
The porter for field data, if it has one.
- class betty.datas.aggregate.record.FieldPorter#
-
An object capable of dumping and loading field data to and from portable data.
- abstractmethod dump(owner: OwnerT, data: DataT, /) PortableData | NothingType#
Dump data to its portable form.
- abstractmethod load(data: PortableData, /) FieldPorterLoadDataT#
Load data from its portable form.
- class betty.datas.aggregate.record.RecordDefinition#
Bases:
DataDefinition,GenericA record data definition.
Records have explicitly defined fields.
- __init__(*args: Any, cls: type[DataT] | None = None, label: ResolvableLocalizable, fields: Mapping[ElementT, ResolvableFieldDefinition[DataT, Any]] | None = None, description: ResolvableLocalizable | None = None, samples: Iterable[Callable[[], Sample[DataT]] | Samples] = (), factory: Callable[..., DataT] | None = None, porter: ResolvableDataDefinitionFeature[Intersection[PorterT, Porter[DataT]], Self, DataT] | None = None, **kwargs: Any)#
- property factory: Callable[..., DataT]#
The factory to create new instances.
The factory’s arguments are kwargs whose names are this record’s field names, and whose values are their fully typed values.
- property fields: Mapping[ElementT, FieldDefinition[DataT, Any]]#
The definitions of the fields contained by this record.
- betty.datas.aggregate.record.resolve_field_definition(field: ResolvableFieldDefinition) FieldDefinition#
Resolve a value to a field definition.