ezKit 3.0.0__tar.gz → 3.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 3.0.0
3
+ Version: 3.0.1
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -26,7 +26,8 @@ class Database:
26
26
 
27
27
  @contextmanager
28
28
  def _get_db(self):
29
- """公用数据库连接上下文管理器"""
29
+ """common database connection context manager"""
30
+ # 公用数据库连接上下文管理器
30
31
  session = self._db_session()
31
32
  try:
32
33
  yield session # 将 session 传递给 with 语句
@@ -37,13 +38,26 @@ class Database:
37
38
  finally:
38
39
  session.close()
39
40
 
40
- def execute(self, statement: str | TextClause | Delete | Insert | Select | Update, scalars: bool = False) -> CursorResult | ScalarResult | None:
41
+ def execute(
42
+ self,
43
+ statement: str | TextClause | Delete | Insert | Select | Update, # SQL 语句
44
+ scalars: bool = False, # 是否使用 scalars() 方法获取结果
45
+ ) -> CursorResult | ScalarResult | None:
41
46
  """database execute statement"""
42
47
 
43
- # SQL 语句既可以是 text() 对象 也可以是 ORM 构建的 statement 对象
48
+ # statement 可以是 纯 SQL 字符串, 也可以是 text() 对象, 也可以是 ORM 构建的 statement 对象
44
49
  #
45
- # text() 对象可以是任意 SQL 语句
46
- # statement 对象包括 select, insert, update, delete 等
50
+ # str: 会使用 text() 转换为 text() 对象
51
+ # TextClause: 已经处理好的 text() 对象, 可以直接使用
52
+ # Select, Insert, Update, Delete: ORM 构建的 statement 对象
53
+ #
54
+ # scalars: 是否使用 scalars() 方法获取结果, 适用于获取单列数据, 如果是多列数据, 使用 execute() 方法获取结果
55
+ #
56
+ # 返回值:
57
+ #
58
+ # CursorResult: 返回 CursorResult 对象
59
+ # ScalarResult: 返回 ScalarResult 对象
60
+ # None: 如果发生错误, 则返回 None
47
61
 
48
62
  info: str = "database execute statement"
49
63
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 3.0.0
3
+ Version: 3.0.1
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name="ezKit",
7
- version="3.0.0",
7
+ version="3.0.1",
8
8
  author="septvean",
9
9
  author_email="septvean@gmail.com",
10
10
  description="Easy Kit",
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