reydb 1.2.20__py3-none-any.whl → 1.2.21__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.
reydb/rconfig.py CHANGED
@@ -79,7 +79,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseEngineT]):
79
79
  if type(self) == DatabaseConfig:
80
80
  self.build_db()
81
81
  elif type(self) == DatabaseConfigAsync:
82
- engine.sync_database.config.build_db()
82
+ engine.sync_engine.config.build_db()
83
83
  self._checked = True
84
84
 
85
85
 
reydb/rdb.py CHANGED
@@ -11,12 +11,19 @@
11
11
 
12
12
  from typing import TypeVar, Generic, Self, Type
13
13
  from functools import wraps as functools_wraps
14
- from reykit.rbase import CallableT, warn
14
+ from reykit.rbase import CallableT, Null, throw, warn
15
15
 
16
16
  from .rbase import DatabaseBase
17
17
  from .rengine import DatabaseEngine, DatabaseEngineAsync
18
18
 
19
19
 
20
+ __all__ = (
21
+ 'DatabaseSuper',
22
+ 'Database',
23
+ 'DatabaseAsync'
24
+ )
25
+
26
+
20
27
  DatabaseEngineT = TypeVar('DatabaseEngineT', DatabaseEngine, DatabaseEngineAsync)
21
28
 
22
29
 
@@ -74,7 +81,7 @@ class DatabaseSuper(DatabaseBase, Generic[DatabaseEngineT]):
74
81
  return func
75
82
 
76
83
 
77
- def __getitem__(self, database: str) -> DatabaseEngineT:
84
+ def __getattr__(self, database: str) -> DatabaseEngineT:
78
85
  """
79
86
  Get added database engine.
80
87
 
@@ -84,12 +91,17 @@ class DatabaseSuper(DatabaseBase, Generic[DatabaseEngineT]):
84
91
  """
85
92
 
86
93
  # Get.
87
- engine = self.__engine_dict[database]
94
+ engine = self.__engine_dict.get(database, Null)
95
+
96
+ # Throw exception.
97
+ if engine == Null:
98
+ text = f"lack of database engine '{database}'"
99
+ throw(AssertionError, text=text)
88
100
 
89
101
  return engine
90
102
 
91
103
 
92
- __getattr__ = __getitem__
104
+ __getitem__ = __getattr__
93
105
 
94
106
 
95
107
  def __contains__(self, database: str) -> bool:
reydb/rengine.py CHANGED
@@ -520,7 +520,7 @@ class DatabaseEngine(
520
520
 
521
521
 
522
522
  @property
523
- def async_database(self) -> 'DatabaseEngineAsync':
523
+ def async_engine(self) -> 'DatabaseEngineAsync':
524
524
  """
525
525
  Same engine `DatabaseEngineAsync` instance.
526
526
  """
@@ -564,7 +564,7 @@ class DatabaseEngineAsync(
564
564
 
565
565
 
566
566
  @property
567
- def sync_database(self) -> DatabaseEngine:
567
+ def sync_engine(self) -> DatabaseEngine:
568
568
  """
569
569
  Same engine `Database` instance.
570
570
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reydb
3
- Version: 1.2.20
3
+ Version: 1.2.21
4
4
  Summary: Database method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reydb/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -2,15 +2,15 @@ reydb/__init__.py,sha256=BnJsTzcwqeQ8-5Boqsehgcpc1eSDkv41v0kdb10gAgM,643
2
2
  reydb/rall.py,sha256=5GI0yuwF72XypNZ1DYIxKizo2Z5pR88Uv0nUpHKYhCk,379
3
3
  reydb/rbase.py,sha256=S3ip2PxvLn2Spgv5G_xd7xgC-U4wjEoAZ7Up25ZQvLk,8223
4
4
  reydb/rbuild.py,sha256=6ZkU3LGkIk04KTPtd8fgTC4pX93p1tvbOhZWWEi-v5A,40846
5
- reydb/rconfig.py,sha256=oOYGqhFzWVPx57D-Bbw6B2F9VmqGc_Y-aTy-mJd0Cgk,18163
5
+ reydb/rconfig.py,sha256=DFGTyoixqlSMGeWyd1os9K7YxnyY3RfgvPqQzZQlMQM,18161
6
6
  reydb/rconn.py,sha256=K_k6cJ94yrPIFaSZ06enpguTWVPhDu67LHan41C1bRA,7023
7
- reydb/rdb.py,sha256=X3ZScVFnPAm6Cqmsx13CCumQH3ZwEQcL4UqpoY42APg,2708
8
- reydb/rengine.py,sha256=CoUh0n5ZG1oRdbcTqCl-s8R8ePXJtIxDg79E6dGx2dU,15644
7
+ reydb/rdb.py,sha256=O3baeNJQo8vqBnLAkn1GSIMn9ORU9-VDO9FPkWZwODA,2975
8
+ reydb/rengine.py,sha256=qkpEsfHleia-bT7DBgERpSlZfszB5mLbRACtG-H2D-s,15640
9
9
  reydb/rerror.py,sha256=M7RPXwywLYl5Vew7jfXxUxVnBrM1b_T6V9Izt4B8zI0,14791
10
10
  reydb/rexec.py,sha256=hZe5SRbqo_aTpuB1vI2HXVx1FjtwvKGLRom3uzjTuqI,52949
11
11
  reydb/rinfo.py,sha256=c5otyOikGMVnLFhPbtlgmnFBRR3NMP7xcmMW-LQdaQk,18314
12
12
  reydb/rorm.py,sha256=mnfVf6fulTJ84EyjFqYijdAwdwaybBVvyZKNG4EhbwU,50065
13
- reydb-1.2.20.dist-info/METADATA,sha256=3WSGgIL7ScE69ImeI9ma3zezy-rgNmZ0dxe1a1WPr1k,1647
14
- reydb-1.2.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- reydb-1.2.20.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
- reydb-1.2.20.dist-info/RECORD,,
13
+ reydb-1.2.21.dist-info/METADATA,sha256=ORyFPj-Ot-KPnH72XKaz1ZHulkKIV06_Mk08zlaqNQs,1647
14
+ reydb-1.2.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ reydb-1.2.21.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
16
+ reydb-1.2.21.dist-info/RECORD,,
File without changes