deev.entities#

final class EntityFieldSpec(**kwargs)#

Bases: _ImmutableMixin

Entity Field Specification

default: Callable[[...], Any] | Any | None#
autoincrement: bool | None#
index: str | None#
mapped: bool | None#
max: int | float | Decimal | None#
min: int | float | Decimal | None#
nullable: bool | None#
primary_key: bool | None#
dbtype: str | None#
unique: bool | None#
validator: Callable[[Any], ValidationError | None] | None#
property sqltype: str | None#
final class EntitySpec(attrs, entity_type, fields, has_autoincrement, primary_key, table_name)#

Bases: _ImmutableMixin

Entity Specification

attrs: Mapping[str, Any]#
entity_type: type#
fields: Mapping[str, EntityFieldSpec]#
has_autoincrement: bool#
primary_key: tuple[str, ...]#
table_name: str#
define_entity_spec(entity_type, *, table_name=None, no_pluralization=False)#
Return type:

EntitySpec

get_entity_spec(entity_type)#

Get the entity spec for entity_type.

Return type:

EntitySpec

entity(cls=None, *, table_name=None, no_pluralization=False)#

Transform a “simple” class definition into an “Entity” class.

Return type:

Any

field(*, autoincrement=None, default=<object object>, index=None, mapped=None, max=None, min=None, nullable=None, primary_key=None, dbtype=None, unique=None, validator=None, init=True)#
Return type:

Any

pluralize(name)#

Derive an plural form of name using simple rules (English).

If the name already appears plural (ends with ‘s’), it is returned unchanged.

Return type:

str