Skip to content

Factory

TypeIDFactory(prefix: str) dataclass

Callable object that generates TypeIDs with a fixed prefix.

Example

user_id = TypeIDFactory("user")()

cached_typeid_factory(prefix: str) -> Callable[[], TypeID] cached

Same as typeid_factory, but caches factories by prefix.

Use this if you create factories repeatedly at runtime.

typeid_factory(prefix: str) -> Callable[[], TypeID]

Return a zero-argument callable that generates TypeIDs with a fixed prefix.

Example

user_id = typeid_factory("user")()