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

Class BinaryField

tortoise/fields/data.py:842–873  ·  view source on GitHub ↗

Binary field. This is for storing ``bytes`` objects. Note that filter or queryset-update operations are not supported.

Source from the content-addressed store, hash-verified

840
841
842class BinaryField(Field[T_BINARY], bytes): # type: ignore
843 """
844 Binary field.
845
846 This is for storing ``bytes`` objects.
847 Note that filter or queryset-update operations are not supported.
848 """
849
850 indexable = False
851 SQL_TYPE = "BLOB"
852
853 @overload
854 def __init__(
855 self: BinaryField[bytes], *, null: Literal[False] = False, **kwargs: Any
856 ) -> None: ...
857
858 @overload
859 def __init__(
860 self: BinaryField[bytes | None], *, null: Literal[True], **kwargs: Any
861 ) -> None: ...
862
863 def __init__(self, **kwargs: Any) -> None:
864 super().__init__(**kwargs)
865
866 class _db_postgres:
867 SQL_TYPE = "BYTEA"
868
869 class _db_mysql:
870 SQL_TYPE = "LONGBLOB"
871
872 class _db_mssql:
873 SQL_TYPE = "VARBINARY(MAX)"
874
875
876class IntEnumFieldInstance(SmallIntField):

Callers 3

test_unique_failFunction · 0.90
test_index_failFunction · 0.90
TypeTestModelClass · 0.90

Calls

no outgoing calls

Tested by 2

test_unique_failFunction · 0.72
test_index_failFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…