MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / to_db_value

Method to_db_value

tortoise/fields/data.py:907–913  ·  view source on GitHub ↗
(self, value: IntEnum | None | int, instance: type[Model] | Model)

Source from the content-addressed store, hash-verified

905 return value
906
907 def to_db_value(self, value: IntEnum | None | int, instance: type[Model] | Model) -> int | None:
908 if isinstance(value, IntEnum):
909 value = int(value.value)
910 if isinstance(value, int):
911 value = int(self.enum_type(value))
912 self.validate(value)
913 return value
914
915
916IntEnumType = TypeVar("IntEnumType", bound=IntEnum)

Callers

nothing calls this directly

Calls 1

validateMethod · 0.80

Tested by

no test coverage detected