ezKit 1.9.0__py3-none-any.whl → 1.9.1__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.
- ezKit/database.py +7 -6
- ezKit/mongo.py +9 -0
- ezKit/redis.py +5 -5
- ezKit/utils.py +1 -2
- {ezKit-1.9.0.dist-info → ezKit-1.9.1.dist-info}/METADATA +1 -1
- {ezKit-1.9.0.dist-info → ezKit-1.9.1.dist-info}/RECORD +9 -9
- {ezKit-1.9.0.dist-info → ezKit-1.9.1.dist-info}/LICENSE +0 -0
- {ezKit-1.9.0.dist-info → ezKit-1.9.1.dist-info}/WHEEL +0 -0
- {ezKit-1.9.0.dist-info → ezKit-1.9.1.dist-info}/top_level.txt +0 -0
ezKit/database.py
CHANGED
@@ -10,6 +10,7 @@ from typing import Any
|
|
10
10
|
|
11
11
|
from loguru import logger
|
12
12
|
from sqlalchemy import CursorResult, Index, create_engine, text
|
13
|
+
from sqlalchemy.orm import DeclarativeBase
|
13
14
|
|
14
15
|
from . import utils
|
15
16
|
|
@@ -19,13 +20,13 @@ class Database():
|
|
19
20
|
|
20
21
|
engine = create_engine('sqlite://')
|
21
22
|
|
22
|
-
def __init__(self,
|
23
|
+
def __init__(self, target: str, **options):
|
23
24
|
"""Initiation"""
|
24
|
-
if
|
25
|
-
if utils.isTrue(
|
26
|
-
self.engine = create_engine(
|
25
|
+
if isinstance(target, str) and utils.isTrue(target, str):
|
26
|
+
if utils.isTrue(options, dict):
|
27
|
+
self.engine = create_engine(target, **options)
|
27
28
|
else:
|
28
|
-
self.engine = create_engine(
|
29
|
+
self.engine = create_engine(target)
|
29
30
|
else:
|
30
31
|
pass
|
31
32
|
|
@@ -45,7 +46,7 @@ class Database():
|
|
45
46
|
logger.exception(e)
|
46
47
|
return False
|
47
48
|
|
48
|
-
def metadata_init(self, base, **kwargs) -> bool:
|
49
|
+
def metadata_init(self, base: DeclarativeBase, **kwargs) -> bool:
|
49
50
|
# https://stackoverflow.com/questions/19175311/how-to-create-only-one-table-with-sqlalchemy
|
50
51
|
info = "Database init table"
|
51
52
|
try:
|
ezKit/mongo.py
CHANGED
@@ -11,6 +11,15 @@ class Mongo():
|
|
11
11
|
|
12
12
|
client = MongoClient()
|
13
13
|
|
14
|
+
def __init__(self, target: str | dict):
|
15
|
+
"""Initiation"""
|
16
|
+
if isinstance(target, str) and utils.isTrue(target, str):
|
17
|
+
self.client = MongoClient(target)
|
18
|
+
elif isinstance(target, dict) and utils.isTrue(target, dict):
|
19
|
+
self.client = MongoClient(**target)
|
20
|
+
else:
|
21
|
+
pass
|
22
|
+
|
14
23
|
def close(self) -> bool:
|
15
24
|
"""client close"""
|
16
25
|
try:
|
ezKit/redis.py
CHANGED
@@ -16,12 +16,12 @@ class Redis:
|
|
16
16
|
# 这里修改以下参数: host, port, socket_timeout, socket_connect_timeout, charset
|
17
17
|
redis = RedisClient.Redis()
|
18
18
|
|
19
|
-
def __init__(self,
|
19
|
+
def __init__(self, target: str | dict):
|
20
20
|
"""Initiation"""
|
21
|
-
if isinstance(
|
22
|
-
self.redis = RedisClient.from_url(
|
23
|
-
elif isinstance(
|
24
|
-
self.redis = RedisClient.Redis(**
|
21
|
+
if isinstance(target, str) and utils.isTrue(target, str):
|
22
|
+
self.redis = RedisClient.from_url(target)
|
23
|
+
elif isinstance(target, dict) and utils.isTrue(target, dict):
|
24
|
+
self.redis = RedisClient.Redis(**target)
|
25
25
|
else:
|
26
26
|
pass
|
27
27
|
|
ezKit/utils.py
CHANGED
@@ -3,18 +3,18 @@ ezKit/bottle.py,sha256=usKK1wVaZw4_D-4VwMYmOIc8jtz4TrpM30nck59HMFw,180178
|
|
3
3
|
ezKit/bottle_extensions.py,sha256=3reEQVZuHklXTl6r7F8kiBFFPb0RaAGc3mYJJnrMDjQ,1129
|
4
4
|
ezKit/cipher.py,sha256=0T_StbjiNI4zgrjVgcfU-ffKgu1waBA9UDudAnqFcNM,2896
|
5
5
|
ezKit/cls.py,sha256=_MZRcYVvCfvh6aCrIXAUixY6Q9rS9X5ab4fckrP66yQ,10324
|
6
|
-
ezKit/database.py,sha256=
|
6
|
+
ezKit/database.py,sha256=3-kikSVzmAKUFFBf_t6GiGAPqWfx4IsZlZgyAI52JHA,6907
|
7
7
|
ezKit/http.py,sha256=i3Kn5AMAMicDMcDjxKKZU7zqEKTU88Ec9_LwCuBJy-0,1801
|
8
|
-
ezKit/mongo.py,sha256=
|
8
|
+
ezKit/mongo.py,sha256=5KDDYQnOE3lw4QJlLp-EAuzbKM6VzbU0w0GR9iklldA,2379
|
9
9
|
ezKit/qywx.py,sha256=X_H4fzP-iEqeDEbumr7D1bXi6dxczaxfO8iyutzy02s,7171
|
10
|
-
ezKit/redis.py,sha256=
|
10
|
+
ezKit/redis.py,sha256=5TQ7s8fkc-ArXuHT5gOlkR0EBgm3Z-9yTTtS1BgI5Qk,1951
|
11
11
|
ezKit/sendemail.py,sha256=3YyBqFHPDZl9CwgWtmGABubARE_ih8P473mIcEp5VsY,8193
|
12
12
|
ezKit/stock.py,sha256=lVzIL1BeB-7Stsm-xToTF7ivZiujozmKKpLErAIN3_A,1730
|
13
13
|
ezKit/token.py,sha256=HKREyZj_T2S8-aFoFIrBXTaCKExQq4zE66OHXhGHqQg,1750
|
14
|
-
ezKit/utils.py,sha256=
|
14
|
+
ezKit/utils.py,sha256=H130-ITDTmd4jwiie6pdyv20mPOk0KZxBcgmtey4rf4,43005
|
15
15
|
ezKit/xftp.py,sha256=XyIdr_2rxRVLqPofG6fIYWhAMVsFwTyp46dg5P9FLW4,7774
|
16
|
-
ezKit-1.9.
|
17
|
-
ezKit-1.9.
|
18
|
-
ezKit-1.9.
|
19
|
-
ezKit-1.9.
|
20
|
-
ezKit-1.9.
|
16
|
+
ezKit-1.9.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
17
|
+
ezKit-1.9.1.dist-info/METADATA,sha256=Jj9sOr2ut2eUgx6kVPqYkgZPmhQlnQHNltlRFxfqXY4,190
|
18
|
+
ezKit-1.9.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
19
|
+
ezKit-1.9.1.dist-info/top_level.txt,sha256=aYLB_1WODsqNTsTFWcKP-BN0KCTKcV-HZJ4zlHkCFw8,6
|
20
|
+
ezKit-1.9.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|