trilium_alchemy.core.entity

Class index

Canonical

BaseEntity

Base class for Trilium entities.

State

Entity state.

Symbols

class trilium_alchemy.core.entity.BaseEntity(*, entity_id: str | None = None, session: Session | None = None, backing_model: EtapiModelT | None = None, create: bool | None = None)

Bases:

abc.ABC
trilium_alchemy.core.session.SessionContainer
trilium_alchemy.core.entity.model.ModelContainer

Base class for Trilium entities.

Should not be instantiated by user, but published for reference.

property state: State

Current state.

property session: Session

Session to which this entity belongs.

property str_short: str

Get a short description of this entity.

property str_summary: str

Get a summary of this entity, including its current state and model values.

flush()

Commit changes to Trilium for this entity and its dependencies.

invalidate()

Discard cached contents and user-provided data for this object.

Upon next access, data will be fetched from Trilium.

delete()

Mark this entity for pending delete.

refresh()

Update value from Trilium, discarding any local changes.

class trilium_alchemy.core.entity.State(*args, **kwds)

Bases:

enum.Enum

Aliases:

trilium_alchemy.State
trilium_alchemy.core.State

Entity state.

Maintained automatically based on the user’s updates and object’s current state in Trilium.

For example, state will change from State.UPDATE back to State.CLEAN if the user reverts changes.

CLEAN

No pending changes.

CREATE

Pending create.

UPDATE

Pending update.

DELETE

Pending delete.

name()

Inherited from: enum.Enum

The name of the Enum member.

value()

Inherited from: enum.Enum

The value of the Enum member.