springbootAI 1.8.0__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.
- spring/__init__.py +66 -0
- spring/ai/__init__.py +78 -0
- spring/ai/advisors.py +139 -0
- spring/ai/annotations.py +74 -0
- spring/ai/autoconfig.py +481 -0
- spring/ai/core.py +391 -0
- spring/ai/etl.py +188 -0
- spring/ai/memory.py +109 -0
- spring/ai/observability.py +129 -0
- spring/ai/providers.py +789 -0
- spring/ai/resilience.py +258 -0
- spring/ai/tools.py +106 -0
- spring/ai/vectorstore.py +303 -0
- spring/annotations/__init__.py +188 -0
- spring/annotations/cache.py +126 -0
- spring/annotations/cloud.py +207 -0
- spring/annotations/conditional.py +272 -0
- spring/annotations/core.py +864 -0
- spring/annotations/messaging.py +107 -0
- spring/aop/__init__.py +4 -0
- spring/aop/cloud_aop.py +404 -0
- spring/aop/comprehensive_aop.py +1015 -0
- spring/aop/method_interceptor.py +19 -0
- spring/aop/proxy_factory.py +55 -0
- spring/cloud/__init__.py +76 -0
- spring/cloud/discovery.py +364 -0
- spring/cloud/feign.py +469 -0
- spring/cloud/gateway.py +452 -0
- spring/cloud/load_balancer.py +149 -0
- spring/cloud/seata.py +557 -0
- spring/cloud/sentinel.py +525 -0
- spring/cloud/tracer.py +337 -0
- spring/config/__init__.py +21 -0
- spring/config/binding.py +206 -0
- spring/config/config_loader.py +405 -0
- spring/context/__init__.py +13 -0
- spring/context/application_context.py +589 -0
- spring/context/bean_definition.py +70 -0
- spring/context/bean_factory.py +1052 -0
- spring/context/registry.py +58 -0
- spring/context/scanner.py +106 -0
- spring/core/__init__.py +3 -0
- spring/core/graceful_shutdown.py +196 -0
- spring/core/typing_utils.py +50 -0
- spring/csv/__init__.py +52 -0
- spring/csv/annotations.py +402 -0
- spring/csv/converters.py +69 -0
- spring/csv/easy_csv.py +95 -0
- spring/csv/exceptions.py +27 -0
- spring/csv/reader.py +195 -0
- spring/csv/writer.py +155 -0
- spring/data/__init__.py +54 -0
- spring/data/page.py +181 -0
- spring/data/repository.py +274 -0
- spring/data/specification.py +228 -0
- spring/datasource/__init__.py +66 -0
- spring/datasource/annotations.py +133 -0
- spring/datasource/context.py +69 -0
- spring/datasource/dynamic.py +148 -0
- spring/event/__init__.py +7 -0
- spring/event/publisher.py +69 -0
- spring/excel/__init__.py +51 -0
- spring/excel/annotations.py +405 -0
- spring/excel/converters.py +231 -0
- spring/excel/easy_excel.py +94 -0
- spring/excel/exceptions.py +31 -0
- spring/excel/reader.py +254 -0
- spring/excel/style.py +95 -0
- spring/excel/writer.py +197 -0
- spring/i18n/__init__.py +97 -0
- spring/i18n/accessor.py +94 -0
- spring/i18n/auto_config.py +177 -0
- spring/i18n/holder.py +106 -0
- spring/i18n/locale.py +152 -0
- spring/i18n/locale_resolver.py +367 -0
- spring/i18n/message_source.py +250 -0
- spring/i18n/middleware.py +79 -0
- spring/i18n/properties.py +168 -0
- spring/i18n/sources.py +255 -0
- spring/logging/__init__.py +1 -0
- spring/logging/loguru_logger.py +228 -0
- spring/main.py +378 -0
- spring/messaging/__init__.py +1 -0
- spring/messaging/rabbitmq.py +302 -0
- spring/monitoring/__init__.py +1 -0
- spring/monitoring/prometheus.py +199 -0
- spring/orm/__init__.py +258 -0
- spring/orm/database.py +222 -0
- spring/orm/ddl_auto.py +1217 -0
- spring/orm/migration.py +419 -0
- spring/orm/mybatis_integration.py +400 -0
- spring/orm/pymybatis/__init__.py +86 -0
- spring/orm/pymybatis/annotations/__init__.py +30 -0
- spring/orm/pymybatis/annotations/annotations.py +332 -0
- spring/orm/pymybatis/cache/__init__.py +47 -0
- spring/orm/pymybatis/cache/cache.py +371 -0
- spring/orm/pymybatis/cache/redis_cache.py +434 -0
- spring/orm/pymybatis/circuit_breaker/__init__.py +21 -0
- spring/orm/pymybatis/circuit_breaker/circuit_breaker.py +424 -0
- spring/orm/pymybatis/configuration.py +525 -0
- spring/orm/pymybatis/core/__init__.py +10 -0
- spring/orm/pymybatis/core/sql_session.py +1382 -0
- spring/orm/pymybatis/core/sql_session_factory.py +76 -0
- spring/orm/pymybatis/dialect/__init__.py +9 -0
- spring/orm/pymybatis/dialect/dialect.py +445 -0
- spring/orm/pymybatis/dynamic_sql/__init__.py +9 -0
- spring/orm/pymybatis/dynamic_sql/dynamic_sql.py +900 -0
- spring/orm/pymybatis/interceptor/__init__.py +31 -0
- spring/orm/pymybatis/interceptor/interceptor.py +427 -0
- spring/orm/pymybatis/mapper/__init__.py +9 -0
- spring/orm/pymybatis/mapper/mapper.py +540 -0
- spring/orm/pymybatis/metrics/__init__.py +41 -0
- spring/orm/pymybatis/metrics/metrics.py +595 -0
- spring/orm/pymybatis/pool/__init__.py +9 -0
- spring/orm/pymybatis/pool/connection_pool.py +711 -0
- spring/orm/pymybatis/security/__init__.py +19 -0
- spring/orm/pymybatis/security/access_control.py +415 -0
- spring/orm/pymybatis/security/password_encoder.py +293 -0
- spring/orm/pymybatis/security/sensitive_data_masker.py +326 -0
- spring/orm/pymybatis/security/sql_injection_detector.py +675 -0
- spring/orm/pymybatis/transaction/__init__.py +9 -0
- spring/orm/pymybatis/transaction/transaction.py +288 -0
- spring/orm/pymybatis/type_handler/__init__.py +37 -0
- spring/orm/pymybatis/type_handler/type_handler.py +473 -0
- spring/orm/pymybatis/version.py +9 -0
- spring/orm/pymybatis/xml_parser/__init__.py +9 -0
- spring/orm/pymybatis/xml_parser/xml_parser.py +761 -0
- spring/retry/__init__.py +12 -0
- spring/retry/retry_annotations.py +71 -0
- spring/retry/retry_decorator.py +155 -0
- spring/scheduling/__init__.py +3 -0
- spring/scheduling/scheduler.py +389 -0
- spring/security/__init__.py +39 -0
- spring/security/jwt_utils.py +281 -0
- spring/security/replay_protection.py +206 -0
- spring/security/secret_manager.py +226 -0
- spring/security/security_aop.py +248 -0
- spring/security/security_context.py +172 -0
- spring/test/__init__.py +45 -0
- spring/test/slicing.py +341 -0
- spring/tracing/__init__.py +11 -0
- spring/tracing/skywalking.py +229 -0
- spring/tx/__init__.py +52 -0
- spring/tx/events.py +172 -0
- spring/tx/synchronization.py +143 -0
- spring/utils/__init__.py +5 -0
- spring/utils/banner.py +32 -0
- spring/utils/logger.py +73 -0
- spring/utils/redis_client.py +526 -0
- spring/validation/__init__.py +55 -0
- spring/validation/aop.py +141 -0
- spring/validation/constraints.py +357 -0
- spring/validation/exceptions.py +55 -0
- spring/validation/validator.py +139 -0
- spring/web/__init__.py +12 -0
- spring/web/actuator.py +319 -0
- spring/web/exception_handler.py +61 -0
- spring/web/health.py +399 -0
- spring/web/interceptor.py +91 -0
- spring/web/result.py +44 -0
- spring/web/swagger.py +601 -0
- spring/web/web_context.py +755 -0
- spring/websocket/__init__.py +86 -0
- spring/websocket/annotations.py +169 -0
- spring/websocket/broker.py +238 -0
- spring/websocket/exceptions.py +26 -0
- spring/websocket/handler.py +243 -0
- spring/websocket/router.py +526 -0
- spring/websocket/session.py +216 -0
- springbootai-1.8.0.dist-info/METADATA +2796 -0
- springbootai-1.8.0.dist-info/RECORD +175 -0
- springbootai-1.8.0.dist-info/WHEEL +5 -0
- springbootai-1.8.0.dist-info/entry_points.txt +2 -0
- springbootai-1.8.0.dist-info/licenses/LICENSE +7 -0
- springbootai-1.8.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PyMyBatis注解模块
|
|
3
|
+
|
|
4
|
+
定义SQL注解:@Select、@Insert、@Update、@Delete、@ResultMap、@Result
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Optional, List, Any, Callable
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _attach(target: Callable, name: str, value: Any) -> Callable:
|
|
11
|
+
setattr(target, name, value)
|
|
12
|
+
return target
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SelectAnnotation:
|
|
16
|
+
"""
|
|
17
|
+
SELECT查询注解数据对象
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, value: str, result_map: Optional[str] = None,
|
|
21
|
+
result_type: Optional[str] = None, fetch_size: Optional[int] = None,
|
|
22
|
+
timeout: Optional[int] = None, cache: bool = True):
|
|
23
|
+
self.value = value
|
|
24
|
+
self.result_map = result_map
|
|
25
|
+
self.result_type = result_type
|
|
26
|
+
self.fetch_size = fetch_size
|
|
27
|
+
self.timeout = timeout
|
|
28
|
+
self.cache = cache
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def Select(value: str, result_map: Optional[str] = None,
|
|
32
|
+
result_type: Optional[str] = None, fetch_size: Optional[int] = None,
|
|
33
|
+
timeout: Optional[int] = None, cache: bool = True) -> Callable:
|
|
34
|
+
"""
|
|
35
|
+
SELECT查询注解装饰器
|
|
36
|
+
|
|
37
|
+
用于标注Mapper接口方法,表示该方法执行SELECT查询
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
value: SQL语句
|
|
41
|
+
result_map: 结果映射ID
|
|
42
|
+
result_type: 结果类型
|
|
43
|
+
fetch_size: 抓取大小
|
|
44
|
+
timeout: 超时时间(秒)
|
|
45
|
+
cache: 是否启用缓存
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
装饰器函数
|
|
49
|
+
"""
|
|
50
|
+
def decorator(func: Callable) -> Callable:
|
|
51
|
+
annotation = SelectAnnotation(value, result_map, result_type,
|
|
52
|
+
fetch_size, timeout, cache)
|
|
53
|
+
setattr(func, 'select', annotation)
|
|
54
|
+
return func
|
|
55
|
+
return decorator
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class InsertAnnotation:
|
|
59
|
+
"""
|
|
60
|
+
INSERT插入注解数据对象
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
def __init__(self, value: str, parameter_type: Optional[str] = None,
|
|
64
|
+
key_property: Optional[str] = None, key_column: Optional[str] = None,
|
|
65
|
+
use_generated_keys: bool = False):
|
|
66
|
+
self.value = value
|
|
67
|
+
self.parameter_type = parameter_type
|
|
68
|
+
self.key_property = key_property
|
|
69
|
+
self.key_column = key_column
|
|
70
|
+
self.use_generated_keys = use_generated_keys
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def Insert(value: str, parameter_type: Optional[str] = None,
|
|
74
|
+
key_property: Optional[str] = None, key_column: Optional[str] = None,
|
|
75
|
+
use_generated_keys: bool = False) -> Callable:
|
|
76
|
+
"""
|
|
77
|
+
INSERT插入注解装饰器
|
|
78
|
+
|
|
79
|
+
用于标注Mapper接口方法,表示该方法执行INSERT操作
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
value: SQL语句
|
|
83
|
+
parameter_type: 参数类型
|
|
84
|
+
key_property: 主键属性名
|
|
85
|
+
key_column: 主键列名
|
|
86
|
+
use_generated_keys: 是否使用自增主键
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
装饰器函数
|
|
90
|
+
"""
|
|
91
|
+
def decorator(func: Callable) -> Callable:
|
|
92
|
+
annotation = InsertAnnotation(value, parameter_type, key_property,
|
|
93
|
+
key_column, use_generated_keys)
|
|
94
|
+
setattr(func, 'insert', annotation)
|
|
95
|
+
return func
|
|
96
|
+
return decorator
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class UpdateAnnotation:
|
|
100
|
+
"""
|
|
101
|
+
UPDATE更新注解数据对象
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
def __init__(self, value: str, parameter_type: Optional[str] = None,
|
|
105
|
+
timeout: Optional[int] = None):
|
|
106
|
+
self.value = value
|
|
107
|
+
self.parameter_type = parameter_type
|
|
108
|
+
self.timeout = timeout
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def Update(value: str, parameter_type: Optional[str] = None,
|
|
112
|
+
timeout: Optional[int] = None) -> Callable:
|
|
113
|
+
"""
|
|
114
|
+
UPDATE更新注解装饰器
|
|
115
|
+
|
|
116
|
+
用于标注Mapper接口方法,表示该方法执行UPDATE操作
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
value: SQL语句
|
|
120
|
+
parameter_type: 参数类型
|
|
121
|
+
timeout: 超时时间(秒)
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
装饰器函数
|
|
125
|
+
"""
|
|
126
|
+
def decorator(func: Callable) -> Callable:
|
|
127
|
+
annotation = UpdateAnnotation(value, parameter_type, timeout)
|
|
128
|
+
setattr(func, 'update', annotation)
|
|
129
|
+
return func
|
|
130
|
+
return decorator
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class DeleteAnnotation:
|
|
134
|
+
"""
|
|
135
|
+
DELETE删除注解数据对象
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
def __init__(self, value: str, parameter_type: Optional[str] = None,
|
|
139
|
+
timeout: Optional[int] = None):
|
|
140
|
+
self.value = value
|
|
141
|
+
self.parameter_type = parameter_type
|
|
142
|
+
self.timeout = timeout
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def Delete(value: str, parameter_type: Optional[str] = None,
|
|
146
|
+
timeout: Optional[int] = None) -> Callable:
|
|
147
|
+
"""
|
|
148
|
+
DELETE删除注解装饰器
|
|
149
|
+
|
|
150
|
+
用于标注Mapper接口方法,表示该方法执行DELETE操作
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
value: SQL语句
|
|
154
|
+
parameter_type: 参数类型
|
|
155
|
+
timeout: 超时时间(秒)
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
装饰器函数
|
|
159
|
+
"""
|
|
160
|
+
def decorator(func: Callable) -> Callable:
|
|
161
|
+
annotation = DeleteAnnotation(value, parameter_type, timeout)
|
|
162
|
+
setattr(func, 'delete', annotation)
|
|
163
|
+
return func
|
|
164
|
+
return decorator
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ProviderAnnotation:
|
|
168
|
+
"""Annotation metadata for Java MyBatis-style SQL providers."""
|
|
169
|
+
|
|
170
|
+
def __init__(self, provider_type: Any, method: Optional[str] = None, **kwargs):
|
|
171
|
+
self.provider_type = provider_type
|
|
172
|
+
self.method = method
|
|
173
|
+
self.options = kwargs
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _provider_decorator(attribute: str, provider_type: Any,
|
|
177
|
+
method: Optional[str] = None, **kwargs) -> Callable:
|
|
178
|
+
def decorator(func: Callable) -> Callable:
|
|
179
|
+
return _attach(func, attribute, ProviderAnnotation(provider_type, method, **kwargs))
|
|
180
|
+
return decorator
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def SelectProvider(provider_type: Any = None, method: Optional[str] = None,
|
|
184
|
+
type: Any = None, value: Any = None, **kwargs) -> Callable:
|
|
185
|
+
"""Build SELECT SQL by calling a provider function or class method."""
|
|
186
|
+
provider = provider_type if provider_type is not None else (type if type is not None else value)
|
|
187
|
+
return _provider_decorator('select_provider', provider, method, **kwargs)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def InsertProvider(provider_type: Any = None, method: Optional[str] = None,
|
|
191
|
+
type: Any = None, value: Any = None, **kwargs) -> Callable:
|
|
192
|
+
provider = provider_type if provider_type is not None else (type if type is not None else value)
|
|
193
|
+
return _provider_decorator('insert_provider', provider, method, **kwargs)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def UpdateProvider(provider_type: Any = None, method: Optional[str] = None,
|
|
197
|
+
type: Any = None, value: Any = None, **kwargs) -> Callable:
|
|
198
|
+
provider = provider_type if provider_type is not None else (type if type is not None else value)
|
|
199
|
+
return _provider_decorator('update_provider', provider, method, **kwargs)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def DeleteProvider(provider_type: Any = None, method: Optional[str] = None,
|
|
203
|
+
type: Any = None, value: Any = None, **kwargs) -> Callable:
|
|
204
|
+
provider = provider_type if provider_type is not None else (type if type is not None else value)
|
|
205
|
+
return _provider_decorator('delete_provider', provider, method, **kwargs)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class Result:
|
|
209
|
+
"""
|
|
210
|
+
结果映射注解
|
|
211
|
+
|
|
212
|
+
用于定义单个字段的映射关系
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
def __init__(self, column: Optional[str] = None, property: Optional[str] = None,
|
|
216
|
+
java_type: Optional[str] = None, jdbc_type: Optional[str] = None):
|
|
217
|
+
self.column = column
|
|
218
|
+
self.property = property
|
|
219
|
+
self.java_type = java_type
|
|
220
|
+
self.jdbc_type = jdbc_type
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class ResultMap:
|
|
224
|
+
"""
|
|
225
|
+
结果映射注解
|
|
226
|
+
|
|
227
|
+
用于定义完整的结果映射
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
def __init__(self, id: str, type: str, results: Optional[List[Result]] = None):
|
|
231
|
+
self.id = id
|
|
232
|
+
self.type = type
|
|
233
|
+
self.results = results or []
|
|
234
|
+
self.mappings = {
|
|
235
|
+
result.column: result.property
|
|
236
|
+
for result in self.results
|
|
237
|
+
if result.column and result.property
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
def __call__(self, target: Callable) -> Callable:
|
|
241
|
+
result_maps = list(getattr(target, '__result_maps__', []))
|
|
242
|
+
result_maps.append(self)
|
|
243
|
+
setattr(target, '__result_maps__', result_maps)
|
|
244
|
+
return target
|
|
245
|
+
|
|
246
|
+
def get_property(self, column: str) -> Optional[str]:
|
|
247
|
+
return self.mappings.get(column)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class Options:
|
|
251
|
+
"""
|
|
252
|
+
选项注解
|
|
253
|
+
|
|
254
|
+
用于配置SQL执行的额外选项
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
def __init__(self, fetch_size: Optional[int] = None, timeout: Optional[int] = None,
|
|
258
|
+
use_cache: bool = True, flush_cache: bool = False,
|
|
259
|
+
use_generated_keys: bool = False,
|
|
260
|
+
key_property: Optional[str] = None,
|
|
261
|
+
key_column: Optional[str] = None):
|
|
262
|
+
self.fetch_size = fetch_size
|
|
263
|
+
self.timeout = timeout
|
|
264
|
+
self.use_cache = use_cache
|
|
265
|
+
self.flush_cache = flush_cache
|
|
266
|
+
self.use_generated_keys = use_generated_keys
|
|
267
|
+
self.key_property = key_property
|
|
268
|
+
self.key_column = key_column
|
|
269
|
+
|
|
270
|
+
def __call__(self, target: Callable) -> Callable:
|
|
271
|
+
return _attach(target, 'options', self)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class Param:
|
|
275
|
+
"""
|
|
276
|
+
参数命名注解
|
|
277
|
+
|
|
278
|
+
用于指定方法参数的名称
|
|
279
|
+
"""
|
|
280
|
+
|
|
281
|
+
def __init__(self, value: str):
|
|
282
|
+
self.value = value
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class CacheNamespace:
|
|
286
|
+
"""
|
|
287
|
+
缓存命名空间注解
|
|
288
|
+
|
|
289
|
+
用于配置Mapper的缓存策略
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
def __init__(self, eviction: str = 'LRU', flush_interval: int = 0,
|
|
293
|
+
size: int = 1024, read_write: bool = True, blocking: bool = False):
|
|
294
|
+
self.eviction = eviction
|
|
295
|
+
self.flush_interval = flush_interval
|
|
296
|
+
self.size = size
|
|
297
|
+
self.read_write = read_write
|
|
298
|
+
self.blocking = blocking
|
|
299
|
+
|
|
300
|
+
def __call__(self, target: Callable) -> Callable:
|
|
301
|
+
return _attach(target, 'cache_namespace', self)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class DataSource:
|
|
305
|
+
"""
|
|
306
|
+
数据源注解
|
|
307
|
+
|
|
308
|
+
用于指定Mapper使用的数据源
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
def __init__(self, value: str):
|
|
312
|
+
self.value = value
|
|
313
|
+
|
|
314
|
+
def __call__(self, target: Callable) -> Callable:
|
|
315
|
+
return _attach(target, 'data_source', self)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class Transactional:
|
|
319
|
+
"""
|
|
320
|
+
事务注解
|
|
321
|
+
|
|
322
|
+
用于标注方法需要在事务中执行
|
|
323
|
+
"""
|
|
324
|
+
|
|
325
|
+
def __init__(self, isolation: str = 'READ_COMMITTED',
|
|
326
|
+
propagation: str = 'REQUIRED', rollback_for: Optional[List[type]] = None):
|
|
327
|
+
self.isolation = isolation
|
|
328
|
+
self.propagation = propagation
|
|
329
|
+
self.rollback_for = rollback_for or []
|
|
330
|
+
|
|
331
|
+
def __call__(self, target: Callable) -> Callable:
|
|
332
|
+
return _attach(target, 'transactional', self)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PyMyBatis缓存模块
|
|
3
|
+
|
|
4
|
+
包含查询缓存、结果集映射缓存、Redis二级缓存等组件
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .cache import (
|
|
8
|
+
CacheType,
|
|
9
|
+
CacheEntry,
|
|
10
|
+
BaseCache,
|
|
11
|
+
LRUCache,
|
|
12
|
+
FIFOCache,
|
|
13
|
+
LFUCache,
|
|
14
|
+
SqlCache,
|
|
15
|
+
ResultMapCache,
|
|
16
|
+
XMLParserCache,
|
|
17
|
+
PrecompiledSqlCache,
|
|
18
|
+
SecondLevelCache,
|
|
19
|
+
GLOBAL_XML_CACHE,
|
|
20
|
+
GLOBAL_PRECOMPILED_CACHE,
|
|
21
|
+
GLOBAL_SECOND_LEVEL_CACHE
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# 基础导出列表
|
|
25
|
+
__all__ = [
|
|
26
|
+
'CacheType',
|
|
27
|
+
'CacheEntry',
|
|
28
|
+
'BaseCache',
|
|
29
|
+
'LRUCache',
|
|
30
|
+
'FIFOCache',
|
|
31
|
+
'LFUCache',
|
|
32
|
+
'SqlCache',
|
|
33
|
+
'ResultMapCache',
|
|
34
|
+
'XMLParserCache',
|
|
35
|
+
'PrecompiledSqlCache',
|
|
36
|
+
'SecondLevelCache',
|
|
37
|
+
'GLOBAL_XML_CACHE',
|
|
38
|
+
'GLOBAL_PRECOMPILED_CACHE',
|
|
39
|
+
'GLOBAL_SECOND_LEVEL_CACHE'
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
# Redis缓存(可选)
|
|
43
|
+
try:
|
|
44
|
+
from .redis_cache import RedisSecondLevelCache, create_redis_cache, SerializationType
|
|
45
|
+
__all__.extend(['RedisSecondLevelCache', 'create_redis_cache', 'SerializationType'])
|
|
46
|
+
except ImportError:
|
|
47
|
+
pass
|