xn-model 1.0.20__py3-none-any.whl → 1.0.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- x_model/field.py +60 -1
- x_model/models.py +2 -3
- {xn_model-1.0.20.dist-info → xn_model-1.0.22.dist-info}/METADATA +1 -1
- xn_model-1.0.22.dist-info/RECORD +9 -0
- xn_model-1.0.20.dist-info/RECORD +0 -9
- {xn_model-1.0.20.dist-info → xn_model-1.0.22.dist-info}/WHEEL +0 -0
- {xn_model-1.0.20.dist-info → xn_model-1.0.22.dist-info}/top_level.txt +0 -0
x_model/field.py
CHANGED
|
@@ -4,10 +4,69 @@ from typing import Any
|
|
|
4
4
|
from asyncpg import Range, Point # Box, Polygon,
|
|
5
5
|
from tortoise import Model
|
|
6
6
|
from tortoise.contrib.postgres.fields import ArrayField
|
|
7
|
-
from tortoise.fields import Field, SmallIntField, IntField, FloatField, DatetimeField
|
|
7
|
+
from tortoise.fields import Field, SmallIntField, IntField, FloatField, DatetimeField, BinaryField, BigIntField
|
|
8
8
|
from tortoise.fields.base import VALUE
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
class UniqBinaryField(BinaryField):
|
|
12
|
+
indexable = True
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class UInt1Field(SmallIntField):
|
|
16
|
+
SQL_TYPE = "SMALLINT" # UINT2
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def constraints(self) -> dict:
|
|
20
|
+
return {
|
|
21
|
+
"ge": 0,
|
|
22
|
+
"le": 255,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class UInt2Field(IntField):
|
|
27
|
+
SQL_TYPE = "INT" # UINT2
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def constraints(self) -> dict:
|
|
31
|
+
return {
|
|
32
|
+
"ge": 0,
|
|
33
|
+
"le": 65535,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class UIntField(BigIntField):
|
|
38
|
+
SQL_TYPE = "BIGINT" # UINT4
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def constraints(self) -> dict:
|
|
42
|
+
return {
|
|
43
|
+
"ge": 0,
|
|
44
|
+
"le": 4_294_967_295,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class UInt8Field(BigIntField):
|
|
49
|
+
SQL_TYPE = "BIGINT" # UINT8
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def constraints(self) -> dict:
|
|
53
|
+
return {
|
|
54
|
+
"ge": 0,
|
|
55
|
+
"le": 18_446_744_073_709_551_615,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class UInt16Field(BigIntField):
|
|
60
|
+
SQL_TYPE = "BIGINT" # UINT16
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def constraints(self) -> dict:
|
|
64
|
+
return {
|
|
65
|
+
"ge": 0,
|
|
66
|
+
"le": 340282366920938463463374607431768211455,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
11
70
|
class ListField(Field[VALUE]):
|
|
12
71
|
base_field = Field[VALUE]
|
|
13
72
|
labels: tuple
|
x_model/models.py
CHANGED
|
@@ -4,10 +4,9 @@ from typing import Self
|
|
|
4
4
|
|
|
5
5
|
from pydantic import ConfigDict
|
|
6
6
|
from tortoise import Model as TortModel
|
|
7
|
-
from tortoise.fields import IntField
|
|
8
7
|
from tortoise.signals import Signals
|
|
9
8
|
|
|
10
|
-
from x_model.field import DatetimeSecField
|
|
9
|
+
from x_model.field import DatetimeSecField, UIntField
|
|
11
10
|
from x_model.types import BaseUpd
|
|
12
11
|
|
|
13
12
|
|
|
@@ -17,7 +16,7 @@ class TsTrait:
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
class Model(TortModel):
|
|
20
|
-
id: int =
|
|
19
|
+
id: int = UIntField(True)
|
|
21
20
|
|
|
22
21
|
_in_type: type[BaseUpd] = None # overridable
|
|
23
22
|
_name: tuple[str] = ("name",)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
x_model/__init__.py,sha256=1Lgvr-SZwkM4R7L0ceVLyArzzMJiFLgaid-RUOk_ypM,344
|
|
2
|
+
x_model/field.py,sha256=C2eV5-FIWsMVknuQSUr9i8NjrScwvuEIuoPQik2qdd8,3866
|
|
3
|
+
x_model/func.py,sha256=flj89sCOou7NJlriPYbIpX8rdbugbe-vjT2C0ORl9DY,312
|
|
4
|
+
x_model/models.py,sha256=Pdkcemb2jSFU0x7YSz9nWVmoGyShF-TzAo2SOUjVbvM,3793
|
|
5
|
+
x_model/types.py,sha256=CITb6DSLZ3KHmEgQRjZCFRUId4x-_pecwZdh6xXt0HE,339
|
|
6
|
+
xn_model-1.0.22.dist-info/METADATA,sha256=uL5UvNS6UxzOZy4ZfxVm1lbYL3FT1SsFM4CxaLrWDpM,986
|
|
7
|
+
xn_model-1.0.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
xn_model-1.0.22.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
+
xn_model-1.0.22.dist-info/RECORD,,
|
xn_model-1.0.20.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
x_model/__init__.py,sha256=1Lgvr-SZwkM4R7L0ceVLyArzzMJiFLgaid-RUOk_ypM,344
|
|
2
|
-
x_model/field.py,sha256=zVszcPZFVEwsurqbFQF-_caiSLruh3TRSZdgQqwWJV8,2776
|
|
3
|
-
x_model/func.py,sha256=flj89sCOou7NJlriPYbIpX8rdbugbe-vjT2C0ORl9DY,312
|
|
4
|
-
x_model/models.py,sha256=aR55uKzYyIZNOIwWlzPym5EViyfcOFrVcMGIu8mItCA,3818
|
|
5
|
-
x_model/types.py,sha256=CITb6DSLZ3KHmEgQRjZCFRUId4x-_pecwZdh6xXt0HE,339
|
|
6
|
-
xn_model-1.0.20.dist-info/METADATA,sha256=htGGIHErxeTgXZLW3asnxKVkxEB9FgGBvHzr7xkypEE,986
|
|
7
|
-
xn_model-1.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
xn_model-1.0.20.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
-
xn_model-1.0.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|