API Reference
enum

@dbzero.enum(values: List[str]) -> EnumType

dbzero.enum(cls: str, values: List[str]) -> EnumType

Creates a persistent, type-safe enumerated type. Enums are useful for defining a set of named constants. Using dbzero enums instead of raw strings for tags or object members prevents accidental clashes and makes your data model more robust and explicit.

Enums can be defined in two ways: using a class decorator or as a direct function call.

Parameters

  • cls str
    The name for the enum type. When used as a decorator, the name is inferred from the class name.

  • values list of str
    A list of unique string names for the enum members. The order of values is preserved.

Returns

A new EnumType object.


Examples

In-depth explanation and examples can be found here