File tree Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change @@ -20,30 +20,6 @@ def load_dialect_impl(self, dialect: Dialect) -> "types.TypeEngine[Any]":
2020
2121
2222class IntEnum (types .TypeDecorator ): # type: ignore
23- """TypeDecorator for Integer-enum conversion.
24-
25- Automatically converts Python enum.IntEnum <-> database integers.
26-
27- Args:
28- enum_type (enum.IntEnum): Integer enum class (subclass of enum.IntEnum)
29-
30- Example:
31- >>> class HeroStatus(enum.IntEnum):
32- ... ACTIVE = 1
33- ... DISABLE = 2
34- >>>>
35- >>> from sqlmodel import IntEnum
36- >>> class Hero(SQLModel):
37- ... hero_status: HeroStatus = Field(sa_type=sqlmodel.IntEnum(HeroStatus))
38- >>> user.hero_status == Status.ACTIVE # Loads back as enum
39-
40- Returns:
41- Optional[enum.IntEnum]: Converted enum instance (None if database value is NULL)
42-
43- Raises:
44- TypeError: For invalid enum types
45- """
46-
4723 impl = types .Integer
4824
4925 def __init__ (self , enum_type : Type [_TIntEnum ], * args : Any , ** kwargs : Any ):
You can’t perform that action at this time.
0 commit comments