ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

module documentation

Undocumented

Class AttributesMixin Attribute handling behavior shared by every model.
Function _cast_bool Cast a raw value to bool handling common textual forms.
Function _cast_date Cast a raw value to date.
Function _cast_datetime Cast a raw value to datetime.
Function _cast_json Cast a raw value to a JSON-decoded Python structure.
Function _cast_uuid Cast a raw value to uuid.UUID.
Function get_cast_handler Return the cast handler registered under the given name.
Function serialize_for_storage Convert attribute values into driver-friendly storage values.
Constant _CAST_HANDLERS Undocumented
Constant _TRUTHY_STRINGS Undocumented
def _cast_bool(value: Any) -> bool: (source)

Cast a raw value to bool handling common textual forms.

Parameters
value:AnyRaw attribute value.
Returns
boolBoolean representation of the value.
def _cast_date(value: Any) -> date: (source)

Cast a raw value to date.

Parameters
value:AnyDate, datetime, or ISO-8601 string.
Returns
dateDate representation of the value.
def _cast_datetime(value: Any) -> datetime: (source)

Cast a raw value to datetime.

Parameters
value:AnyDatetime instance, ISO-8601 string, or POSIX timestamp.
Returns
datetimeDatetime representation of the value.
def _cast_json(value: Any) -> Any: (source)

Cast a raw value to a JSON-decoded Python structure.

Parameters
value:AnyJSON string, or an already decoded structure.
Returns
AnyDecoded Python structure.
def _cast_uuid(value: Any) -> uuid.UUID: (source)

Cast a raw value to uuid.UUID.

Parameters
value:AnyUUID instance or its string form.
Returns
uuid.UUIDUUID representation of the value.
def get_cast_handler(cast: str) -> Callable[[Any], Any]: (source)

Return the cast handler registered under the given name.

Parameters
cast:strCast name declared in a model casts mapping.
Returns
CallableFunction converting raw values into the cast type.
Raises
OrmExceptionIf the cast name is not supported.
def serialize_for_storage(meta: ModelMetadata, values: dict[str, Any]) -> dict[str, Any]: (source)

Convert attribute values into driver-friendly storage values.

JSON-cast structures stored in non-JSON columns are serialized to strings, and UUID objects targeting non-UUID columns are stringified; every other value passes through unchanged.

Parameters
meta:ModelMetadataMetadata of the model owning the attributes.
values:dictAttribute values to serialize.
Returns
dictValues ready to be bound into an SQL statement.
_CAST_HANDLERS: dict[str, Callable[[Any], Any]] = (source)

Undocumented

Value
{'int': int,
 'float': float,
 'bool': _cast_bool,
 'datetime': _cast_datetime,
 'date': _cast_date,
 'json': _cast_json,
 'uuid': _cast_uuid}
_TRUTHY_STRINGS: frozenset[str] = (source)

Undocumented

Value
frozenset(set(['1', 'true', 'yes', 'on']))