xtn-tools-pro 1.0.1.4.6__py3-none-any.whl → 1.0.1.4.7__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.
- xtn_tools_pro/db/RedisDB.py +10 -3
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/RECORD +7 -7
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/entry_points.txt +0 -0
- {xtn_tools_pro-1.0.1.4.6.dist-info → xtn_tools_pro-1.0.1.4.7.dist-info}/top_level.txt +0 -0
xtn_tools_pro/db/RedisDB.py
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# --------------------------------------------------------------------------------------------------
|
|
9
9
|
# 2024/4/18 xiatn V00.01.000 新建
|
|
10
10
|
# --------------------------------------------------------------------------------------------------
|
|
11
|
+
import json
|
|
11
12
|
import time
|
|
12
13
|
import redis
|
|
13
14
|
from redis import Redis
|
|
@@ -188,16 +189,21 @@ class RedisDBPro:
|
|
|
188
189
|
"""
|
|
189
190
|
return self._redis.hset(name=table, key=key, value=value, mapping=mapping)
|
|
190
191
|
|
|
191
|
-
def hget(self,name,key):
|
|
192
|
+
def hget(self, name, key, is_json=False):
|
|
192
193
|
"""
|
|
193
194
|
读单个
|
|
194
195
|
:param name: 表
|
|
195
196
|
:param key: key
|
|
197
|
+
:param is_json: True 会转为json
|
|
196
198
|
:return:
|
|
197
199
|
"""
|
|
198
|
-
|
|
200
|
+
data = self._redis.hget(name, key)
|
|
201
|
+
if not is_json:
|
|
202
|
+
return data
|
|
203
|
+
json_data = json.loads(data)
|
|
204
|
+
return json_data
|
|
199
205
|
|
|
200
|
-
def hgetall(self,name):
|
|
206
|
+
def hgetall(self, name):
|
|
201
207
|
"""
|
|
202
208
|
读全部字段(小 Hash 可用,大 Hash 慎用)
|
|
203
209
|
:param name:
|
|
@@ -205,6 +211,7 @@ class RedisDBPro:
|
|
|
205
211
|
"""
|
|
206
212
|
return self._redis.hgetall(name)
|
|
207
213
|
|
|
214
|
+
|
|
208
215
|
if __name__ == '__main__':
|
|
209
216
|
pass
|
|
210
217
|
# r = RedisDBPro(ip="127.0.0.1", port=6379, db=0, user_pass="xtn-kk")
|
|
@@ -7,7 +7,7 @@ xtn_tools_pro/data/__init__.py,sha256=Cg6fMz1PlSjPa1LUyQtpzvvjvFdxiky_PjxaNFr3wI
|
|
|
7
7
|
xtn_tools_pro/data/set_data_pro.py,sha256=Cg6fMz1PlSjPa1LUyQtpzvvjvFdxiky_PjxaNFr3wIo,418
|
|
8
8
|
xtn_tools_pro/db/MongoDB.py,sha256=CljtA5NnutOPL0j2ClrCE4RXW-9N_306D3PAdRANmuk,5699
|
|
9
9
|
xtn_tools_pro/db/MysqlDB.py,sha256=SBJrcjbZdxmtTKPGwl57NthPhs4uX8J3P6o_rK01O4k,13373
|
|
10
|
-
xtn_tools_pro/db/RedisDB.py,sha256=
|
|
10
|
+
xtn_tools_pro/db/RedisDB.py,sha256=isORf1w-lQPTN9WqoU0WH1LP0irIcwIwzYNq9PdoUxE,7619
|
|
11
11
|
xtn_tools_pro/db/__init__.py,sha256=Zg91UWS02TO0Ba_0AY56s0oabRy93xLNFkpIIL_6mMM,416
|
|
12
12
|
xtn_tools_pro/flask_demo/__init__.py,sha256=2hSMIjKC8-T_9aTJU35DjkwWKa1-ZzMgwfFajs69TWI,418
|
|
13
13
|
xtn_tools_pro/flask_demo/cli.py,sha256=wBcdWu5uN1QB8begyGHnhSln4IiZJPTFE8CDy0sQGTk,3116
|
|
@@ -70,9 +70,9 @@ xtn_tools_pro/utils/shell.py,sha256=s6sJedxLLQokcI1hF5YSD3qgGUPK0brNcP-D3-yv54I,
|
|
|
70
70
|
xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
|
|
71
71
|
xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
|
|
72
72
|
xtn_tools_pro/utils/win.py,sha256=D5_58WMKOGe9ZwJuJr2JGAWmVISwMOZUx4t7wXUCviU,3512
|
|
73
|
-
xtn_tools_pro-1.0.1.4.
|
|
74
|
-
xtn_tools_pro-1.0.1.4.
|
|
75
|
-
xtn_tools_pro-1.0.1.4.
|
|
76
|
-
xtn_tools_pro-1.0.1.4.
|
|
77
|
-
xtn_tools_pro-1.0.1.4.
|
|
78
|
-
xtn_tools_pro-1.0.1.4.
|
|
73
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/METADATA,sha256=a8dVvuMLhGyWVoTF6ldORD1QitE19-UWqvkqKPcqh30,597
|
|
75
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
76
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/entry_points.txt,sha256=t8CtXWOgw7nRDW3XNlZh8MT_P4l8EzsFnyWi5b3ovrc,68
|
|
77
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
|
78
|
+
xtn_tools_pro-1.0.1.4.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|