cloudoll 2.2.27__tar.gz → 2.2.29__tar.gz
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.
- {cloudoll-2.2.27 → cloudoll-2.2.29}/PKG-INFO +19 -1
- {cloudoll-2.2.27 → cloudoll-2.2.29}/README.md +5 -0
- cloudoll-2.2.29/cloudoll/__init__.py +1 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/cli.py +2 -2
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/__init__.py +6 -2
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/field.py +19 -1
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/m2d.py +1 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/watch.py +8 -7
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/__init__.py +2 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/PKG-INFO +19 -1
- cloudoll-2.2.27/cloudoll/__init__.py +0 -1
- {cloudoll-2.2.27 → cloudoll-2.2.29}/LICENSE +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/__main__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/error/__init__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/error/errors.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/logging/__init__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/mail/smtp.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/base.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/err.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/model.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/mysql.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/parse.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/robot/__init__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/robot/dingtalk.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/robot/feishu.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/robot/slack.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/common.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/patch_loop.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/utils/snowflake.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/exception.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/html.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/http.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/jwt.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll/web/settings.py +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/requires.txt +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/setup.cfg +0 -0
- {cloudoll-2.2.27 → cloudoll-2.2.29}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudoll
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.29
|
|
4
4
|
Summary: 辅助快速创建可分布的微服务。
|
|
5
5
|
Home-page: https://gitee.com/chuchur/cloudoll-py
|
|
6
6
|
Author: chuchur
|
|
@@ -15,11 +15,29 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
15
15
|
Requires-Python: >=3.6.0
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: watchfiles
|
|
19
|
+
Requires-Dist: curl_cffi
|
|
20
|
+
Requires-Dist: colorlog
|
|
21
|
+
Requires-Dist: aiomysql
|
|
22
|
+
Requires-Dist: aiopg
|
|
23
|
+
Requires-Dist: aiohttp
|
|
24
|
+
Requires-Dist: redis[hiredis]
|
|
25
|
+
Requires-Dist: aiomcache
|
|
26
|
+
Requires-Dist: jinja2
|
|
27
|
+
Requires-Dist: pyjwt
|
|
28
|
+
Requires-Dist: aiohttp_session[secure]
|
|
29
|
+
Requires-Dist: PyYAML
|
|
30
|
+
Requires-Dist: click
|
|
18
31
|
|
|
19
32
|
|
|
20
33
|
# cloudoll 云端玩具
|
|
21
34
|
|
|
22
35
|
## 更新日志
|
|
36
|
+
|
|
37
|
+
`2.2.28` 2023-07-04
|
|
38
|
+
- 多数据库支持
|
|
39
|
+
- 优化orm
|
|
40
|
+
-
|
|
23
41
|
`2.0.14` 2023-07-04
|
|
24
42
|
- 加入cli,devtoll
|
|
25
43
|
- 优化orm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.29"
|
|
@@ -89,7 +89,7 @@ def start(environment, host, port, mode, path, entry) -> None:
|
|
|
89
89
|
# print(environment, host, port, mode, path, entry)
|
|
90
90
|
# return
|
|
91
91
|
if mode == 'production':
|
|
92
|
-
App = app.create(config=config, entry_model=entry)
|
|
92
|
+
App = app.create(env=environment, config=config, entry_model=entry)
|
|
93
93
|
App.run()
|
|
94
94
|
return
|
|
95
95
|
aux_app = web.Application(
|
|
@@ -102,7 +102,7 @@ def start(environment, host, port, mode, path, entry) -> None:
|
|
|
102
102
|
config["server"] = server
|
|
103
103
|
|
|
104
104
|
aux_port = int(server.port) + 1
|
|
105
|
-
task = AppTask(Path(".").resolve(), config, entry=entry)
|
|
105
|
+
task = AppTask(Path(".").resolve(), config, entry=entry, env=environment)
|
|
106
106
|
aux_app.cleanup_ctx.append(task.cleanup_ctx)
|
|
107
107
|
web.run_app(
|
|
108
108
|
aux_app,
|
|
@@ -116,13 +116,15 @@ class Postgres(MeteBase):
|
|
|
116
116
|
|
|
117
117
|
async def query(self, sql, params=None, query_type: QueryTypes = 2, size: int = 10):
|
|
118
118
|
sql = sql.replace("?", "%s").replace('`', '"')
|
|
119
|
-
print_info("sql", sql, params)
|
|
120
119
|
if not self.pool:
|
|
121
120
|
raise ValueError("must be create_engine first.")
|
|
122
121
|
if self.pool._closing or self.pool._closed:
|
|
123
122
|
return None
|
|
124
123
|
|
|
125
124
|
async with self.pool.acquire() as conn:
|
|
125
|
+
if conn.echo:
|
|
126
|
+
print_info("sql", sql, params)
|
|
127
|
+
|
|
126
128
|
async with conn.cursor() as cursor:
|
|
127
129
|
# current_cursor = getattr(cursor, 'lastrowid', None)
|
|
128
130
|
if (
|
|
@@ -226,12 +228,14 @@ class Mysql(MeteBase):
|
|
|
226
228
|
|
|
227
229
|
async def query(self, sql, params=None, query_type: QueryTypes = 2, size: int = 10):
|
|
228
230
|
sql = sql.replace("?", "%s")
|
|
229
|
-
# print_info("sql", sql, params)
|
|
230
231
|
if not self.pool:
|
|
231
232
|
raise ValueError("must be create_engine first.")
|
|
232
233
|
if self.pool._closing or self.pool._closed:
|
|
233
234
|
return None
|
|
234
235
|
async with self.pool.acquire() as conn:
|
|
236
|
+
if conn.echo:
|
|
237
|
+
print_info("sql", sql, params)
|
|
238
|
+
|
|
235
239
|
async with conn.cursor() as cursor:
|
|
236
240
|
# current_cursor = getattr(cursor, 'lastrowid', None)
|
|
237
241
|
if (
|
|
@@ -31,6 +31,8 @@ OP = objdict(
|
|
|
31
31
|
AVG="AVG",
|
|
32
32
|
AS="AS",
|
|
33
33
|
SUM="SUM",
|
|
34
|
+
MAX="MAX",
|
|
35
|
+
MIN="MIN",
|
|
34
36
|
IS_TODAY="IS_TODAY",
|
|
35
37
|
IS_THIS_WEEK="THIS_WEEK",
|
|
36
38
|
IS_THIS_MONTH="THIS_MONTH",
|
|
@@ -50,6 +52,7 @@ OP = objdict(
|
|
|
50
52
|
DATE_FORMAT="DATE_FORMAT",
|
|
51
53
|
JSON_CONTAINS_OBJECT="JSON_CONTAINS_OBJECT",
|
|
52
54
|
JSON_CONTAINS_ARRAY="JSON_CONTAINS_ARRAY",
|
|
55
|
+
GROUP_CONCAT='GROUP_CONCAT',
|
|
53
56
|
COUNT="COUNT",
|
|
54
57
|
COUNT_WHEN="COUNT_WHEN",
|
|
55
58
|
IS_NOT="IS NOT",
|
|
@@ -119,6 +122,9 @@ class FieldBase(object):
|
|
|
119
122
|
def count(self):
|
|
120
123
|
return Function(self, OP.COUNT)
|
|
121
124
|
|
|
125
|
+
def max(self):
|
|
126
|
+
return Function(self, OP.MAX)
|
|
127
|
+
|
|
122
128
|
def count_when(self, value):
|
|
123
129
|
return Function(self, OP.COUNT_WHEN, value)
|
|
124
130
|
|
|
@@ -284,7 +290,9 @@ class Function(FieldBase):
|
|
|
284
290
|
return f"{col_name} < NOW() - INTERVAL {self.rpt} MINUTE", None
|
|
285
291
|
elif op == OP.BEFORE_SECONDS:
|
|
286
292
|
return f"{col_name} < NOW() - INTERVAL {self.rpt} SECOND", None
|
|
287
|
-
|
|
293
|
+
elif op == OP.CONTAINS:
|
|
294
|
+
return f"{col_name} LIKE CONCAT('%%',?,'%%')", [self.rpt]
|
|
295
|
+
# return f"CONTAINS({col_name},?)", [self.rpt]
|
|
288
296
|
elif op == OP.JSON_CONTAINS_OBJECT:
|
|
289
297
|
_k, _v = self.rpt
|
|
290
298
|
key = _k.full_name if isinstance(_k, Field) else f"'{_k}'"
|
|
@@ -300,6 +308,16 @@ class Function(FieldBase):
|
|
|
300
308
|
return f"COUNT({col_name})", None
|
|
301
309
|
elif op == OP.COUNT_WHEN:
|
|
302
310
|
return f"COUNT(CASE WHEN {col_name} = ? THEN 1 END)", [self.rpt]
|
|
311
|
+
elif op == OP.SUM:
|
|
312
|
+
return f"SUM({col_name})", None
|
|
313
|
+
elif op == OP.AVG:
|
|
314
|
+
return f"AVG({col_name})", None
|
|
315
|
+
elif op == OP.MAX:
|
|
316
|
+
return f"MAX({col_name})", None
|
|
317
|
+
elif op == OP.MIN:
|
|
318
|
+
return f"MIN({col_name})", None
|
|
319
|
+
elif op == OP.GROUP_CONCAT:
|
|
320
|
+
return f"GROUP_CONCAT({col_name})", None
|
|
303
321
|
|
|
304
322
|
|
|
305
323
|
class Expression(FieldBase):
|
|
@@ -201,6 +201,7 @@ def get_col(field, driver="mysql"):
|
|
|
201
201
|
"default": field["Default"],
|
|
202
202
|
"charset": field["Collation"],
|
|
203
203
|
"max_length": None,
|
|
204
|
+
"scale_length":None,
|
|
204
205
|
"auto_increment": field["Extra"] == "auto_increment",
|
|
205
206
|
"NOT_NULL": field["Null"] == "NO",
|
|
206
207
|
"created_generated": "DEFAULT_GENERATED" == field["Extra"],
|
|
@@ -72,11 +72,11 @@ def set_tty(tty_path: Optional[str]) -> Iterator[None]:
|
|
|
72
72
|
yield
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
def mian_app(tty_path, config, entry):
|
|
75
|
+
def mian_app(tty_path, config, entry, env):
|
|
76
76
|
with set_tty(tty_path):
|
|
77
77
|
if sys.version_info >= (3, 11):
|
|
78
78
|
with asyncio.Runner() as runner:
|
|
79
|
-
app_runner = runner.run(create_main_app(config, entry))
|
|
79
|
+
app_runner = runner.run(create_main_app(config, entry, env))
|
|
80
80
|
try:
|
|
81
81
|
runner.run(start_main_app(app_runner, config["server"]["port"]))
|
|
82
82
|
runner.get_loop().run_forever()
|
|
@@ -87,7 +87,7 @@ def mian_app(tty_path, config, entry):
|
|
|
87
87
|
runner.run(app_runner.cleanup())
|
|
88
88
|
else:
|
|
89
89
|
loop = asyncio.new_event_loop()
|
|
90
|
-
runner = loop.run_until_complete(create_main_app(config, entry))
|
|
90
|
+
runner = loop.run_until_complete(create_main_app(config, entry, env))
|
|
91
91
|
try:
|
|
92
92
|
loop.run_until_complete(
|
|
93
93
|
start_main_app(runner, config["server"]["port"])
|
|
@@ -100,9 +100,9 @@ def mian_app(tty_path, config, entry):
|
|
|
100
100
|
loop.run_until_complete(runner.cleanup())
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
async def create_main_app(config, entry):
|
|
103
|
+
async def create_main_app(config, entry, env):
|
|
104
104
|
await check_port_open(config["server"]["port"])
|
|
105
|
-
App = app.create(config=config, entry_model=entry)
|
|
105
|
+
App = app.create(env=env, config=config, entry_model=entry)
|
|
106
106
|
return web.AppRunner(App.app, shutdown_timeout=0.1)
|
|
107
107
|
|
|
108
108
|
|
|
@@ -113,9 +113,10 @@ async def start_main_app(runner, port):
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
class AppTask(WatchTask):
|
|
116
|
-
def __init__(self, watch_path: str, config, entry: None):
|
|
116
|
+
def __init__(self, watch_path: str, config, entry: None, env: str):
|
|
117
117
|
self._config = config
|
|
118
118
|
self._entry = entry
|
|
119
|
+
self._env = env
|
|
119
120
|
self._reloads = 0
|
|
120
121
|
assert watch_path
|
|
121
122
|
super().__init__(watch_path)
|
|
@@ -153,7 +154,7 @@ class AppTask(WatchTask):
|
|
|
153
154
|
tty_path = None
|
|
154
155
|
|
|
155
156
|
self._process = Process(
|
|
156
|
-
target=mian_app, args=(tty_path, self._config, self._entry)
|
|
157
|
+
target=mian_app, args=(tty_path, self._config, self._entry, self._env)
|
|
157
158
|
)
|
|
158
159
|
self._process.start()
|
|
159
160
|
|
|
@@ -203,6 +203,7 @@ class Application(object):
|
|
|
203
203
|
|
|
204
204
|
def create(self, env: str = None, entry_model: str = None, config=None):
|
|
205
205
|
# self.init_parse()
|
|
206
|
+
self.env = env
|
|
206
207
|
loop = asyncio.get_event_loop()
|
|
207
208
|
if loop is None:
|
|
208
209
|
loop = asyncio.new_event_loop()
|
|
@@ -233,6 +234,7 @@ class Application(object):
|
|
|
233
234
|
self.app.on_startup.append(self._init_database)
|
|
234
235
|
self.app.on_cleanup.append(self._close_database)
|
|
235
236
|
self.app.config = config
|
|
237
|
+
self.app.env = env
|
|
236
238
|
self.app.jwt_encode = self.jwt_encode
|
|
237
239
|
self.app.jwt_decode = self.jwt_decode
|
|
238
240
|
# session
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudoll
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.29
|
|
4
4
|
Summary: 辅助快速创建可分布的微服务。
|
|
5
5
|
Home-page: https://gitee.com/chuchur/cloudoll-py
|
|
6
6
|
Author: chuchur
|
|
@@ -15,11 +15,29 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
15
15
|
Requires-Python: >=3.6.0
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: watchfiles
|
|
19
|
+
Requires-Dist: curl_cffi
|
|
20
|
+
Requires-Dist: colorlog
|
|
21
|
+
Requires-Dist: aiomysql
|
|
22
|
+
Requires-Dist: aiopg
|
|
23
|
+
Requires-Dist: aiohttp
|
|
24
|
+
Requires-Dist: redis[hiredis]
|
|
25
|
+
Requires-Dist: aiomcache
|
|
26
|
+
Requires-Dist: jinja2
|
|
27
|
+
Requires-Dist: pyjwt
|
|
28
|
+
Requires-Dist: aiohttp_session[secure]
|
|
29
|
+
Requires-Dist: PyYAML
|
|
30
|
+
Requires-Dist: click
|
|
18
31
|
|
|
19
32
|
|
|
20
33
|
# cloudoll 云端玩具
|
|
21
34
|
|
|
22
35
|
## 更新日志
|
|
36
|
+
|
|
37
|
+
`2.2.28` 2023-07-04
|
|
38
|
+
- 多数据库支持
|
|
39
|
+
- 优化orm
|
|
40
|
+
-
|
|
23
41
|
`2.0.14` 2023-07-04
|
|
24
42
|
- 加入cli,devtoll
|
|
25
43
|
- 优化orm
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.27"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|