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.

class documentation

class StateMixin: (source)

Known subclasses: orionis.orm.Model

View In Hierarchy

Attribute state tracking behavior shared by every model.

Tracks the original attribute snapshot taken at hydration or after the last successful save, the current attribute values, and the changes applied by the most recent save operation.

Method getChanges Return the attributes persisted by the last save operation.
Method getDirty Return the attributes modified since the last sync.
Method getOriginal Return the original attribute snapshot or a single original value.
Method isClean Report whether no attribute changed since the last sync.
Method isDirty Report whether any attribute changed since the last sync.
Method syncOriginal Snapshot the current attributes as the new original state.
Method wasChanged Report whether the last save operation changed any attribute.
Class Variable __slots__ Undocumented
def getChanges(self) -> dict[str, Any]: (source)

Return the attributes persisted by the last save operation.

Returns
dictAttribute values written by the last save.
def getDirty(self) -> dict[str, Any]: (source)

Return the attributes modified since the last sync.

Returns
dictChanged attribute values keyed by name.
def getOriginal(self, key: str | None = None, default: Any = None) -> Any: (source)

Return the original attribute snapshot or a single original value.

Parameters
key:str or None, optionalAttribute name, or None for the whole snapshot.
default:Any, optionalValue returned when the attribute is absent.
Returns
AnyOriginal snapshot dictionary, or the original value for the requested key.
def isClean(self, *attributes: str) -> bool: (source)

Report whether no attribute changed since the last sync.

Parameters
*attributes:strRestrict the check to these attribute names when provided.
Returns
boolTrue when no tracked attribute changed.
def isDirty(self, *attributes: str) -> bool: (source)

Report whether any attribute changed since the last sync.

Parameters
*attributes:strRestrict the check to these attribute names when provided.
Returns
boolTrue when at least one tracked attribute changed.
def syncOriginal(self) -> Any: (source)

Snapshot the current attributes as the new original state.

Returns
ModelThe same instance, enabling fluent chaining.
def wasChanged(self, *attributes: str) -> bool: (source)

Report whether the last save operation changed any attribute.

Parameters
*attributes:strRestrict the check to these attribute names when provided.
Returns
boolTrue when the last save persisted at least one change.
__slots__: tuple = (source)
overridden in orionis.orm.Model

Undocumented