reydb 1.2.16__py3-none-any.whl → 1.2.17__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 +24 -33
- reydb/rerror.py +12 -21
- {reydb-1.2.16.dist-info → reydb-1.2.17.dist-info}/METADATA +1 -1
- {reydb-1.2.16.dist-info → reydb-1.2.17.dist-info}/RECORD +6 -6
- {reydb-1.2.16.dist-info → reydb-1.2.17.dist-info}/WHEEL +0 -0
- {reydb-1.2.16.dist-info → reydb-1.2.17.dist-info}/licenses/LICENSE +0 -0
reydb/rconfig.py
CHANGED
@@ -57,17 +57,8 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
57
57
|
"""
|
58
58
|
Database config super type.
|
59
59
|
Can create database used `self.build_db` method.
|
60
|
-
|
61
|
-
Attributes
|
62
|
-
----------
|
63
|
-
db_names : Database table name mapping dictionary.
|
64
60
|
"""
|
65
61
|
|
66
|
-
db_names = {
|
67
|
-
'config': 'config',
|
68
|
-
'stats_config': 'stats_config'
|
69
|
-
}
|
70
|
-
|
71
62
|
|
72
63
|
def __init__(self, db: DatabaseT) -> None:
|
73
64
|
"""
|
@@ -84,7 +75,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
84
75
|
|
85
76
|
def handle_build_db(self) -> tuple[list[type[DatabaseTableConfig]], list[dict[str, Any]]] :
|
86
77
|
"""
|
87
|
-
Handle method of check and build database tables
|
78
|
+
Handle method of check and build database tables.
|
88
79
|
|
89
80
|
Returns
|
90
81
|
-------
|
@@ -92,21 +83,21 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
92
83
|
"""
|
93
84
|
|
94
85
|
# Parameter.
|
86
|
+
database = self.db.database
|
95
87
|
|
96
88
|
## Table.
|
97
|
-
DatabaseTableConfig._set_name(self.db_names['config'])
|
98
89
|
tables = [DatabaseTableConfig]
|
99
90
|
|
100
91
|
## View stats.
|
101
92
|
views_stats = [
|
102
93
|
{
|
103
|
-
'path':
|
94
|
+
'path': 'stats_config',
|
104
95
|
'items': [
|
105
96
|
{
|
106
97
|
'name': 'count',
|
107
98
|
'select': (
|
108
99
|
'SELECT COUNT(1)\n'
|
109
|
-
f'FROM `{
|
100
|
+
f'FROM `{database}`.`config`'
|
110
101
|
),
|
111
102
|
'comment': 'Config count.'
|
112
103
|
},
|
@@ -114,7 +105,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
114
105
|
'name': 'last_create_time',
|
115
106
|
'select': (
|
116
107
|
'SELECT MAX(`create_time`)\n'
|
117
|
-
f'FROM `{
|
108
|
+
f'FROM `{database}`.`config`'
|
118
109
|
),
|
119
110
|
'comment': 'Config last record create time.'
|
120
111
|
},
|
@@ -122,7 +113,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
122
113
|
'name': 'last_update_time',
|
123
114
|
'select': (
|
124
115
|
'SELECT MAX(`update_time`)\n'
|
125
|
-
f'FROM `{
|
116
|
+
f'FROM `{database}`.`config`'
|
126
117
|
),
|
127
118
|
'comment': 'Config last record update time.'
|
128
119
|
}
|
@@ -150,7 +141,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
150
141
|
|
151
142
|
def build_db(self) -> None:
|
152
143
|
"""
|
153
|
-
Check and build database tables
|
144
|
+
Check and build database tables.
|
154
145
|
"""
|
155
146
|
|
156
147
|
# Parameter.
|
@@ -171,7 +162,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
171
162
|
|
172
163
|
# Get.
|
173
164
|
result = self.db.execute.select(
|
174
|
-
|
165
|
+
'config',
|
175
166
|
['key', 'value', 'note'],
|
176
167
|
order='IFNULL(`update_time`, `create_time`) DESC'
|
177
168
|
)
|
@@ -207,7 +198,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
207
198
|
# Get.
|
208
199
|
where = '`key` = :key'
|
209
200
|
result = self.db.execute.select(
|
210
|
-
|
201
|
+
'config',
|
211
202
|
'`value`',
|
212
203
|
where,
|
213
204
|
limit=1,
|
@@ -253,7 +244,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
253
244
|
'note': note
|
254
245
|
}
|
255
246
|
result = self.db.execute.insert(
|
256
|
-
|
247
|
+
'config',
|
257
248
|
data,
|
258
249
|
'ignore'
|
259
250
|
)
|
@@ -286,7 +277,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
286
277
|
|
287
278
|
# Update.
|
288
279
|
self.db.execute.insert(
|
289
|
-
|
280
|
+
'config',
|
290
281
|
data,
|
291
282
|
'update'
|
292
283
|
)
|
@@ -309,7 +300,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
309
300
|
where = '`key` in :key'
|
310
301
|
limit = None
|
311
302
|
result = self.db.execute.delete(
|
312
|
-
|
303
|
+
'config',
|
313
304
|
where,
|
314
305
|
limit=limit,
|
315
306
|
key=key
|
@@ -331,7 +322,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
331
322
|
|
332
323
|
# Get.
|
333
324
|
result = self.db.execute.select(
|
334
|
-
|
325
|
+
'config',
|
335
326
|
['key', 'value']
|
336
327
|
)
|
337
328
|
|
@@ -357,7 +348,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
357
348
|
|
358
349
|
# Get.
|
359
350
|
result = self.db.execute.select(
|
360
|
-
|
351
|
+
'config',
|
361
352
|
'`key`'
|
362
353
|
)
|
363
354
|
|
@@ -382,7 +373,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
382
373
|
|
383
374
|
# Get.
|
384
375
|
result = self.db.execute.select(
|
385
|
-
|
376
|
+
'config',
|
386
377
|
'`value`'
|
387
378
|
)
|
388
379
|
|
@@ -466,7 +457,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
466
457
|
|
467
458
|
async def build_db(self) -> None:
|
468
459
|
"""
|
469
|
-
Asynchronous check and build database tables
|
460
|
+
Asynchronous check and build database tables.
|
470
461
|
"""
|
471
462
|
|
472
463
|
# Parameter.
|
@@ -487,7 +478,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
487
478
|
|
488
479
|
# Get.
|
489
480
|
result = await self.db.execute.select(
|
490
|
-
|
481
|
+
'config',
|
491
482
|
['key', 'value', 'note'],
|
492
483
|
order='IFNULL(`update_time`, `create_time`) DESC'
|
493
484
|
)
|
@@ -523,7 +514,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
523
514
|
# Get.
|
524
515
|
where = '`key` = :key'
|
525
516
|
result = await self.db.execute.select(
|
526
|
-
|
517
|
+
'config',
|
527
518
|
'`value`',
|
528
519
|
where,
|
529
520
|
limit=1,
|
@@ -569,7 +560,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
569
560
|
'note': note
|
570
561
|
}
|
571
562
|
result = await self.db.execute.insert(
|
572
|
-
|
563
|
+
'config',
|
573
564
|
data,
|
574
565
|
'ignore'
|
575
566
|
)
|
@@ -602,7 +593,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
602
593
|
|
603
594
|
# Update.
|
604
595
|
await self.db.execute.insert(
|
605
|
-
|
596
|
+
'config',
|
606
597
|
data,
|
607
598
|
'update'
|
608
599
|
)
|
@@ -625,7 +616,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
625
616
|
where = '`key` in :key'
|
626
617
|
limit = None
|
627
618
|
result = await self.db.execute.delete(
|
628
|
-
|
619
|
+
'config',
|
629
620
|
where,
|
630
621
|
limit=limit,
|
631
622
|
key=key
|
@@ -647,7 +638,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
647
638
|
|
648
639
|
# Get.
|
649
640
|
result = await self.db.execute.select(
|
650
|
-
|
641
|
+
'config',
|
651
642
|
['key', 'value']
|
652
643
|
)
|
653
644
|
|
@@ -673,7 +664,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
673
664
|
|
674
665
|
# Get.
|
675
666
|
result = await self.db.execute.select(
|
676
|
-
|
667
|
+
'config',
|
677
668
|
'`key`'
|
678
669
|
)
|
679
670
|
|
@@ -698,7 +689,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
698
689
|
|
699
690
|
# Get.
|
700
691
|
result = await self.db.execute.select(
|
701
|
-
|
692
|
+
'config',
|
702
693
|
'`value`'
|
703
694
|
)
|
704
695
|
|
reydb/rerror.py
CHANGED
@@ -51,17 +51,8 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
51
51
|
"""
|
52
52
|
Database error super type.
|
53
53
|
Can create database used `self.build_db` method.
|
54
|
-
|
55
|
-
Attributes
|
56
|
-
----------
|
57
|
-
db_names : Database table name mapping dictionary.
|
58
54
|
"""
|
59
55
|
|
60
|
-
db_names = {
|
61
|
-
'error': 'error',
|
62
|
-
'stats_error': 'stats_error'
|
63
|
-
}
|
64
|
-
|
65
56
|
|
66
57
|
def __init__(self, db: DatabaseT) -> None:
|
67
58
|
"""
|
@@ -78,7 +69,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
78
69
|
|
79
70
|
def handle_build_db(self) -> tuple[list[type[DatabaseTableError]], list[dict[str, Any]]]:
|
80
71
|
"""
|
81
|
-
Handle method of check and build database tables
|
72
|
+
Handle method of check and build database tables.
|
82
73
|
|
83
74
|
Returns
|
84
75
|
-------
|
@@ -86,21 +77,21 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
86
77
|
"""
|
87
78
|
|
88
79
|
# Parameter.
|
80
|
+
database = self.db.database
|
89
81
|
|
90
82
|
## Table.
|
91
|
-
DatabaseTableError._set_name(self.db_names['error'])
|
92
83
|
tables = [DatabaseTableError]
|
93
84
|
|
94
85
|
## View stats.
|
95
86
|
views_stats = [
|
96
87
|
{
|
97
|
-
'path':
|
88
|
+
'path': 'stats_error',
|
98
89
|
'items': [
|
99
90
|
{
|
100
91
|
'name': 'count',
|
101
92
|
'select': (
|
102
93
|
'SELECT COUNT(1)\n'
|
103
|
-
f'FROM `{
|
94
|
+
f'FROM `{database}`.`error`'
|
104
95
|
),
|
105
96
|
'comment': 'Error log count.'
|
106
97
|
},
|
@@ -108,7 +99,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
108
99
|
'name': 'past_day_count',
|
109
100
|
'select': (
|
110
101
|
'SELECT COUNT(1)\n'
|
111
|
-
f'FROM `{
|
102
|
+
f'FROM `{database}`.`error`\n'
|
112
103
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
113
104
|
),
|
114
105
|
'comment': 'Error log count in the past day.'
|
@@ -117,7 +108,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
117
108
|
'name': 'past_week_count',
|
118
109
|
'select': (
|
119
110
|
'SELECT COUNT(1)\n'
|
120
|
-
f'FROM `{
|
111
|
+
f'FROM `{database}`.`error`\n'
|
121
112
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
122
113
|
),
|
123
114
|
'comment': 'Error log count in the past week.'
|
@@ -126,7 +117,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
126
117
|
'name': 'past_month_count',
|
127
118
|
'select': (
|
128
119
|
'SELECT COUNT(1)\n'
|
129
|
-
f'FROM `{
|
120
|
+
f'FROM `{database}`.`error`\n'
|
130
121
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
131
122
|
),
|
132
123
|
'comment': 'Error log count in the past month.'
|
@@ -135,7 +126,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
135
126
|
'name': 'last_time',
|
136
127
|
'select': (
|
137
128
|
'SELECT MAX(`create_time`)\n'
|
138
|
-
f'FROM `{
|
129
|
+
f'FROM `{database}`.`error`'
|
139
130
|
),
|
140
131
|
'comment': 'Error log last record create time.'
|
141
132
|
}
|
@@ -193,7 +184,7 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
193
184
|
|
194
185
|
def build_db(self) -> None:
|
195
186
|
"""
|
196
|
-
Check and build database tables
|
187
|
+
Check and build database tables.
|
197
188
|
"""
|
198
189
|
|
199
190
|
# Parameter.
|
@@ -224,7 +215,7 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
224
215
|
|
225
216
|
# Insert.
|
226
217
|
self.db.execute.insert(
|
227
|
-
|
218
|
+
'error',
|
228
219
|
data=data
|
229
220
|
)
|
230
221
|
|
@@ -371,7 +362,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
371
362
|
|
372
363
|
async def build_db(self) -> None:
|
373
364
|
"""
|
374
|
-
Asynchronous check and build database tables
|
365
|
+
Asynchronous check and build database tables.
|
375
366
|
"""
|
376
367
|
|
377
368
|
# Parameter.
|
@@ -402,7 +393,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
402
393
|
|
403
394
|
# Insert.
|
404
395
|
await self.db.execute.insert(
|
405
|
-
|
396
|
+
'error',
|
406
397
|
data=data
|
407
398
|
)
|
408
399
|
|
@@ -2,14 +2,14 @@ reydb/__init__.py,sha256=MJkZy2rOM2VSj_L2kaKe6CJfsg334vb3OLVUqavWKfM,558
|
|
2
2
|
reydb/rall.py,sha256=IxSPGh77xz7ndDC7J8kZ_66Gq_xTAztGtnELUku1Ouw,364
|
3
3
|
reydb/rbase.py,sha256=sl2lZWQVC5kXTJid2v5zmy1lMshYLm2NhEQi_dnY_Bw,8232
|
4
4
|
reydb/rbuild.py,sha256=QZF26KDL6oRb6RyMEtIJcbiX9TJzK2aUPqjqGjflF7s,80834
|
5
|
-
reydb/rconfig.py,sha256=
|
5
|
+
reydb/rconfig.py,sha256=ZmVpoP7GuwuP3536Lz34kaZDG5MCVf0JFBaT5nm1-L8,17686
|
6
6
|
reydb/rconn.py,sha256=guRaR8N6RuzZzujwaeq7HhKWTizF9SrUBqEAFjfjpoo,6909
|
7
7
|
reydb/rdb.py,sha256=s96XLLH8ZmJm-q4J9RRP6KGkxH3MGodPOcWqB-6-V4U,14356
|
8
|
-
reydb/rerror.py,sha256=
|
8
|
+
reydb/rerror.py,sha256=0AIe7ZpDEe60xTV_FJCCBwzFVHwONh7qxvYpgwzZDvI,14401
|
9
9
|
reydb/rexec.py,sha256=DdmcJ6j4il06wEyvhttac2GpmGdsZJtOEljH7wUvca8,52948
|
10
10
|
reydb/rinfo.py,sha256=1lMnD-eN97vHrQ1DM8X7mQIhyLmCg6V0P2QwSeF07_c,18127
|
11
11
|
reydb/rorm.py,sha256=77QQgQglvA2b4fRH1xBqca7BQ-Hu2MudDopRPJ6E4J4,50761
|
12
|
-
reydb-1.2.
|
13
|
-
reydb-1.2.
|
14
|
-
reydb-1.2.
|
15
|
-
reydb-1.2.
|
12
|
+
reydb-1.2.17.dist-info/METADATA,sha256=zfoqQQNi3sPymiV82KzaBJS_-c4ZA_3r2VIMq9xK3WU,1647
|
13
|
+
reydb-1.2.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
+
reydb-1.2.17.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
+
reydb-1.2.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|