Skip to content

Class tigrbl.orm.mixins.hierarchy.TreeNode

tigrbl.orm.mixins.hierarchy.TreeNode

Self-nesting hierarchy.

path class-attribute instance-attribute

path = acol(
    spec=ColumnSpec(
        storage=S(type_=String),
        field=F(py_type=str),
        io=CRUD_IO,
    )
)

parent_id

parent_id()
Source code in tigrbl/orm/mixins/hierarchy.py
32
33
34
35
36
37
38
39
40
41
42
43
@declared_attr
def parent_id(cls) -> Mapped[UUID | None]:
    spec = ColumnSpec(
        storage=S(
            type_=PgUUID(as_uuid=True),
            fk=ForeignKeySpec(target=f"{cls.__tablename__}.id"),
            nullable=True,
        ),
        field=F(py_type=UUID),
        io=CRUD_IO,
    )
    return acol(spec=spec)