ormlambda 3.34.9__py3-none-any.whl → 3.35.0__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.
- ormlambda/databases/my_sql/caster/caster.py +2 -0
- ormlambda/databases/my_sql/caster/types/__init__.py +1 -0
- ormlambda/databases/my_sql/caster/types/json.py +31 -0
- ormlambda/sql/sqltypes.py +5 -1
- {ormlambda-3.34.9.dist-info → ormlambda-3.35.0.dist-info}/METADATA +1 -1
- {ormlambda-3.34.9.dist-info → ormlambda-3.35.0.dist-info}/RECORD +9 -8
- {ormlambda-3.34.9.dist-info → ormlambda-3.35.0.dist-info}/AUTHORS +0 -0
- {ormlambda-3.34.9.dist-info → ormlambda-3.35.0.dist-info}/LICENSE +0 -0
- {ormlambda-3.34.9.dist-info → ormlambda-3.35.0.dist-info}/WHEEL +0 -0
@@ -13,6 +13,7 @@ from .types import (
|
|
13
13
|
IterableCaster,
|
14
14
|
BooleanCaster,
|
15
15
|
DecimalCaster,
|
16
|
+
JsonCaster,
|
16
17
|
)
|
17
18
|
|
18
19
|
from shapely import Point
|
@@ -40,4 +41,5 @@ class MySQLCaster(Caster):
|
|
40
41
|
list: IterableCaster,
|
41
42
|
bool: BooleanCaster,
|
42
43
|
Decimal: DecimalCaster,
|
44
|
+
dict:JsonCaster
|
43
45
|
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from ormlambda.caster import BaseCaster, Caster
|
3
|
+
import json
|
4
|
+
|
5
|
+
class JsonCaster[TType](BaseCaster[dict, TType]):
|
6
|
+
def __init__(self, value: dict, type_value: TType):
|
7
|
+
super().__init__(value, type_value)
|
8
|
+
|
9
|
+
def wildcard_to_select(self, value: Optional[str] = None) -> str:
|
10
|
+
return Caster.PLACEHOLDER if value is None else value
|
11
|
+
|
12
|
+
def wildcard_to_where(self, value: Optional[str] = None) -> str:
|
13
|
+
return Caster.PLACEHOLDER if value is None else value
|
14
|
+
|
15
|
+
def wildcard_to_insert(self, value: Optional[str] = None) -> str:
|
16
|
+
return Caster.PLACEHOLDER if value is None else value
|
17
|
+
|
18
|
+
@property
|
19
|
+
@BaseCaster.return_value_if_exists
|
20
|
+
def to_database(self) -> Optional[str]:
|
21
|
+
return json.dumps(self.value)
|
22
|
+
|
23
|
+
@property
|
24
|
+
@BaseCaster.return_value_if_exists
|
25
|
+
def from_database(self) -> Optional[str]:
|
26
|
+
return json.loads(self.value)
|
27
|
+
|
28
|
+
@property
|
29
|
+
@BaseCaster.return_value_if_exists
|
30
|
+
def string_data(self) -> Optional[str]:
|
31
|
+
return f"'{self.value}'"
|
ormlambda/sql/sqltypes.py
CHANGED
@@ -452,7 +452,11 @@ class Point(TypeEngine[_python_Point]):
|
|
452
452
|
class JSON(TypeEngine[Any]):
|
453
453
|
"""JSON data type."""
|
454
454
|
|
455
|
-
__visit_name__ = "
|
455
|
+
__visit_name__ = "JSON"
|
456
|
+
|
457
|
+
@property
|
458
|
+
def python_type(self) -> Type[dict]:
|
459
|
+
return dict
|
456
460
|
|
457
461
|
|
458
462
|
type UuidType = str | _python_UUID
|
@@ -24,8 +24,8 @@ ormlambda/common/interfaces/__init__.py,sha256=np5wuAnBVAHDyD01-X3M9qPmzbjOzP6KN
|
|
24
24
|
ormlambda/databases/__init__.py,sha256=uMUnB19I5qlpjLkepLpNhk9L3--fijXmHNMledQWj5w,96
|
25
25
|
ormlambda/databases/my_sql/__init__.py,sha256=nDSgvRuifTJ8FXcgdOrEguYnv-VBFyCOKrQWr0RHCiY,158
|
26
26
|
ormlambda/databases/my_sql/caster/__init__.py,sha256=Df2sdZaAJ1Mi5Ego0sILMk5pF1NbK-nlV0hbpzd0PWE,47
|
27
|
-
ormlambda/databases/my_sql/caster/caster.py,sha256=
|
28
|
-
ormlambda/databases/my_sql/caster/types/__init__.py,sha256=
|
27
|
+
ormlambda/databases/my_sql/caster/caster.py,sha256=G2CDqkrmsxFrHe_nDOmqqrTA_3O2o6gIIfukqPeHmJs,1021
|
28
|
+
ormlambda/databases/my_sql/caster/types/__init__.py,sha256=BmtHuVvKGPIOCjVuqQZgtGBMnx15YnGBaBi4r3Hd-3U,587
|
29
29
|
ormlambda/databases/my_sql/caster/types/boolean.py,sha256=EYOxnR7-XU30UYZbBbMH4pyynTw5CPU1G8V5xpCthg4,1100
|
30
30
|
ormlambda/databases/my_sql/caster/types/bytes.py,sha256=Mzl5oI2q6hGL9TFrTS-Ae1olQlAVtvNoxTSLUSBb5v8,1026
|
31
31
|
ormlambda/databases/my_sql/caster/types/date.py,sha256=8usP1Af7WUzEC8BHOBL16Zjg9j-ipMlb42p0UTFELmg,1176
|
@@ -34,6 +34,7 @@ ormlambda/databases/my_sql/caster/types/decimal.py,sha256=ycQnSqO-aFkrcsa8JKVPdn
|
|
34
34
|
ormlambda/databases/my_sql/caster/types/float.py,sha256=EbU6J3yoL5_naLowfibkfUC9Bk9WzDaWks7lJ2pNhyA,1026
|
35
35
|
ormlambda/databases/my_sql/caster/types/int.py,sha256=a30xbe0LNj2BvbtLNZhUXFvT3WJ115MFsHC19Y3NLTk,1016
|
36
36
|
ormlambda/databases/my_sql/caster/types/iterable.py,sha256=nFPMOiaahzw_HWSdMZLRDQVim0aWUMoP-OLvp7vONC4,1029
|
37
|
+
ormlambda/databases/my_sql/caster/types/json.py,sha256=AR7D6CEgyK3zAEijyNO1AuWtLBgC7KTj-YNEWkyilkg,1042
|
37
38
|
ormlambda/databases/my_sql/caster/types/none.py,sha256=Bl4jpVVyoLG7ehoCAYj9lFBZbRWbyDN8QsQeWmIb84I,948
|
38
39
|
ormlambda/databases/my_sql/caster/types/point.py,sha256=GHAf51kE0AS7wOlCYM9YW-z2ZbmY8hXwcHs979ZCeaY,1442
|
39
40
|
ormlambda/databases/my_sql/caster/types/string.py,sha256=WFjTC5phuJ_-ShuokndFbqGuFgGZZx9GbpozH4rlB2g,1017
|
@@ -127,7 +128,7 @@ ormlambda/sql/functions/max.py,sha256=wXNhFmOlMyD1sKcaBO9asQeXcfY0OvMQPkrlARVXgd
|
|
127
128
|
ormlambda/sql/functions/min.py,sha256=MTRGXgwzbLgKk9PJpn6JGK1TU91hZe_VsTszngLOh7Q,1570
|
128
129
|
ormlambda/sql/functions/sum.py,sha256=_TN8SitDDBVD6VlsHZH3RpmiE5hkFrGGgC3tuEctKjk,1614
|
129
130
|
ormlambda/sql/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
130
|
-
ormlambda/sql/sqltypes.py,sha256=
|
131
|
+
ormlambda/sql/sqltypes.py,sha256=cqP33UzFx-cAXYosvBIht06O6LqR6miAnAFaDDxXtHY,14409
|
131
132
|
ormlambda/sql/table/__init__.py,sha256=LLZcMLjwFxgBCPhdm5UQYYZDIbtYWCKPO9CbcXsy5zI,50
|
132
133
|
ormlambda/sql/table/fields.py,sha256=ovNR3bJ473aKW-2NhbKr0iJlVpgW06jurHLob2IyZU8,2116
|
133
134
|
ormlambda/sql/table/table.py,sha256=l_oXhTHid09IaG-eapBxZTdaNrWCVgGHWLDHnIrrEqY,6484
|
@@ -151,8 +152,8 @@ ormlambda/util/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkj
|
|
151
152
|
ormlambda/util/module_tree/dynamic_module.py,sha256=vJOqvm5-WKksudXBK1IcTn4WsuLxt1qXNISq-_21sy4,8705
|
152
153
|
ormlambda/util/plugin_loader.py,sha256=p6WLn-MF1bQd2i2GHy98WQjNKmbQdqIUyTFIcBIHC5M,1034
|
153
154
|
ormlambda/util/typing.py,sha256=Z7irz53ui0hoFnJTe06NX4JPl60_thgdjJIxh5gjGGk,169
|
154
|
-
ormlambda-3.
|
155
|
-
ormlambda-3.
|
156
|
-
ormlambda-3.
|
157
|
-
ormlambda-3.
|
158
|
-
ormlambda-3.
|
155
|
+
ormlambda-3.35.0.dist-info/AUTHORS,sha256=uWpOHaCPTOLbVkk5x9McoLwbgzSeCg7yILeDRyMGWGM,606
|
156
|
+
ormlambda-3.35.0.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
|
157
|
+
ormlambda-3.35.0.dist-info/METADATA,sha256=Z4kT8T0DtDB11oDxUuL8Zc3jR21861m8Y0BfwdGsvyk,13326
|
158
|
+
ormlambda-3.35.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
159
|
+
ormlambda-3.35.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|