Open waketzheng opened 4 days ago
As #966 said, IntEnumField inherit from SmallIntField, so it can not use a enum_type with value > 32767
This PR add a IntEnumFieldMixin to make it easy to custom a new IntEnumField:
from typing import Type, cast from tortoise.fields.data import IntEnumFieldMixin, IntEnumType, IntField class IntEnumInstance(IntEnumFieldMixin, IntField): pass def IntEnumField(enum_type: Type[IntEnumType], **kwargs) -> IntEnumType: return cast(IntEnumType, IntEnumInstance(enum_type, **kwargs))
make ci
Description
As #966 said, IntEnumField inherit from SmallIntField, so it can not use a enum_type with value > 32767
Motivation and Context
This PR add a IntEnumFieldMixin to make it easy to custom a new IntEnumField:
How Has This Been Tested?
make ci
Checklist: