MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / __init__

Method __init__

tortoise/contrib/mysql/fields.py:34–41  ·  view source on GitHub ↗
(self, binary_compression: bool = True, **kwargs: Any)

Source from the content-addressed store, hash-verified

32 SQL_TYPE = "CHAR(36)"
33
34 def __init__(self, binary_compression: bool = True, **kwargs: Any) -> None:
35 if (kwargs.get("primary_key") or kwargs.get("pk", False)) and "default" not in kwargs:
36 kwargs["default"] = uuid4
37 super().__init__(**kwargs)
38
39 if binary_compression:
40 self.SQL_TYPE = "BINARY(16)"
41 self._binary_compression = binary_compression
42
43 def to_db_value(self, value: Any, instance: type[Model] | Model) -> str | bytes | None: # type: ignore
44 # Make sure that value is a UUIDv4

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected