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.
Files changed (175) hide show
  1. spring/__init__.py +66 -0
  2. spring/ai/__init__.py +78 -0
  3. spring/ai/advisors.py +139 -0
  4. spring/ai/annotations.py +74 -0
  5. spring/ai/autoconfig.py +481 -0
  6. spring/ai/core.py +391 -0
  7. spring/ai/etl.py +188 -0
  8. spring/ai/memory.py +109 -0
  9. spring/ai/observability.py +129 -0
  10. spring/ai/providers.py +789 -0
  11. spring/ai/resilience.py +258 -0
  12. spring/ai/tools.py +106 -0
  13. spring/ai/vectorstore.py +303 -0
  14. spring/annotations/__init__.py +188 -0
  15. spring/annotations/cache.py +126 -0
  16. spring/annotations/cloud.py +207 -0
  17. spring/annotations/conditional.py +272 -0
  18. spring/annotations/core.py +864 -0
  19. spring/annotations/messaging.py +107 -0
  20. spring/aop/__init__.py +4 -0
  21. spring/aop/cloud_aop.py +404 -0
  22. spring/aop/comprehensive_aop.py +1015 -0
  23. spring/aop/method_interceptor.py +19 -0
  24. spring/aop/proxy_factory.py +55 -0
  25. spring/cloud/__init__.py +76 -0
  26. spring/cloud/discovery.py +364 -0
  27. spring/cloud/feign.py +469 -0
  28. spring/cloud/gateway.py +452 -0
  29. spring/cloud/load_balancer.py +149 -0
  30. spring/cloud/seata.py +557 -0
  31. spring/cloud/sentinel.py +525 -0
  32. spring/cloud/tracer.py +337 -0
  33. spring/config/__init__.py +21 -0
  34. spring/config/binding.py +206 -0
  35. spring/config/config_loader.py +405 -0
  36. spring/context/__init__.py +13 -0
  37. spring/context/application_context.py +589 -0
  38. spring/context/bean_definition.py +70 -0
  39. spring/context/bean_factory.py +1052 -0
  40. spring/context/registry.py +58 -0
  41. spring/context/scanner.py +106 -0
  42. spring/core/__init__.py +3 -0
  43. spring/core/graceful_shutdown.py +196 -0
  44. spring/core/typing_utils.py +50 -0
  45. spring/csv/__init__.py +52 -0
  46. spring/csv/annotations.py +402 -0
  47. spring/csv/converters.py +69 -0
  48. spring/csv/easy_csv.py +95 -0
  49. spring/csv/exceptions.py +27 -0
  50. spring/csv/reader.py +195 -0
  51. spring/csv/writer.py +155 -0
  52. spring/data/__init__.py +54 -0
  53. spring/data/page.py +181 -0
  54. spring/data/repository.py +274 -0
  55. spring/data/specification.py +228 -0
  56. spring/datasource/__init__.py +66 -0
  57. spring/datasource/annotations.py +133 -0
  58. spring/datasource/context.py +69 -0
  59. spring/datasource/dynamic.py +148 -0
  60. spring/event/__init__.py +7 -0
  61. spring/event/publisher.py +69 -0
  62. spring/excel/__init__.py +51 -0
  63. spring/excel/annotations.py +405 -0
  64. spring/excel/converters.py +231 -0
  65. spring/excel/easy_excel.py +94 -0
  66. spring/excel/exceptions.py +31 -0
  67. spring/excel/reader.py +254 -0
  68. spring/excel/style.py +95 -0
  69. spring/excel/writer.py +197 -0
  70. spring/i18n/__init__.py +97 -0
  71. spring/i18n/accessor.py +94 -0
  72. spring/i18n/auto_config.py +177 -0
  73. spring/i18n/holder.py +106 -0
  74. spring/i18n/locale.py +152 -0
  75. spring/i18n/locale_resolver.py +367 -0
  76. spring/i18n/message_source.py +250 -0
  77. spring/i18n/middleware.py +79 -0
  78. spring/i18n/properties.py +168 -0
  79. spring/i18n/sources.py +255 -0
  80. spring/logging/__init__.py +1 -0
  81. spring/logging/loguru_logger.py +228 -0
  82. spring/main.py +378 -0
  83. spring/messaging/__init__.py +1 -0
  84. spring/messaging/rabbitmq.py +302 -0
  85. spring/monitoring/__init__.py +1 -0
  86. spring/monitoring/prometheus.py +199 -0
  87. spring/orm/__init__.py +258 -0
  88. spring/orm/database.py +222 -0
  89. spring/orm/ddl_auto.py +1217 -0
  90. spring/orm/migration.py +419 -0
  91. spring/orm/mybatis_integration.py +400 -0
  92. spring/orm/pymybatis/__init__.py +86 -0
  93. spring/orm/pymybatis/annotations/__init__.py +30 -0
  94. spring/orm/pymybatis/annotations/annotations.py +332 -0
  95. spring/orm/pymybatis/cache/__init__.py +47 -0
  96. spring/orm/pymybatis/cache/cache.py +371 -0
  97. spring/orm/pymybatis/cache/redis_cache.py +434 -0
  98. spring/orm/pymybatis/circuit_breaker/__init__.py +21 -0
  99. spring/orm/pymybatis/circuit_breaker/circuit_breaker.py +424 -0
  100. spring/orm/pymybatis/configuration.py +525 -0
  101. spring/orm/pymybatis/core/__init__.py +10 -0
  102. spring/orm/pymybatis/core/sql_session.py +1382 -0
  103. spring/orm/pymybatis/core/sql_session_factory.py +76 -0
  104. spring/orm/pymybatis/dialect/__init__.py +9 -0
  105. spring/orm/pymybatis/dialect/dialect.py +445 -0
  106. spring/orm/pymybatis/dynamic_sql/__init__.py +9 -0
  107. spring/orm/pymybatis/dynamic_sql/dynamic_sql.py +900 -0
  108. spring/orm/pymybatis/interceptor/__init__.py +31 -0
  109. spring/orm/pymybatis/interceptor/interceptor.py +427 -0
  110. spring/orm/pymybatis/mapper/__init__.py +9 -0
  111. spring/orm/pymybatis/mapper/mapper.py +540 -0
  112. spring/orm/pymybatis/metrics/__init__.py +41 -0
  113. spring/orm/pymybatis/metrics/metrics.py +595 -0
  114. spring/orm/pymybatis/pool/__init__.py +9 -0
  115. spring/orm/pymybatis/pool/connection_pool.py +711 -0
  116. spring/orm/pymybatis/security/__init__.py +19 -0
  117. spring/orm/pymybatis/security/access_control.py +415 -0
  118. spring/orm/pymybatis/security/password_encoder.py +293 -0
  119. spring/orm/pymybatis/security/sensitive_data_masker.py +326 -0
  120. spring/orm/pymybatis/security/sql_injection_detector.py +675 -0
  121. spring/orm/pymybatis/transaction/__init__.py +9 -0
  122. spring/orm/pymybatis/transaction/transaction.py +288 -0
  123. spring/orm/pymybatis/type_handler/__init__.py +37 -0
  124. spring/orm/pymybatis/type_handler/type_handler.py +473 -0
  125. spring/orm/pymybatis/version.py +9 -0
  126. spring/orm/pymybatis/xml_parser/__init__.py +9 -0
  127. spring/orm/pymybatis/xml_parser/xml_parser.py +761 -0
  128. spring/retry/__init__.py +12 -0
  129. spring/retry/retry_annotations.py +71 -0
  130. spring/retry/retry_decorator.py +155 -0
  131. spring/scheduling/__init__.py +3 -0
  132. spring/scheduling/scheduler.py +389 -0
  133. spring/security/__init__.py +39 -0
  134. spring/security/jwt_utils.py +281 -0
  135. spring/security/replay_protection.py +206 -0
  136. spring/security/secret_manager.py +226 -0
  137. spring/security/security_aop.py +248 -0
  138. spring/security/security_context.py +172 -0
  139. spring/test/__init__.py +45 -0
  140. spring/test/slicing.py +341 -0
  141. spring/tracing/__init__.py +11 -0
  142. spring/tracing/skywalking.py +229 -0
  143. spring/tx/__init__.py +52 -0
  144. spring/tx/events.py +172 -0
  145. spring/tx/synchronization.py +143 -0
  146. spring/utils/__init__.py +5 -0
  147. spring/utils/banner.py +32 -0
  148. spring/utils/logger.py +73 -0
  149. spring/utils/redis_client.py +526 -0
  150. spring/validation/__init__.py +55 -0
  151. spring/validation/aop.py +141 -0
  152. spring/validation/constraints.py +357 -0
  153. spring/validation/exceptions.py +55 -0
  154. spring/validation/validator.py +139 -0
  155. spring/web/__init__.py +12 -0
  156. spring/web/actuator.py +319 -0
  157. spring/web/exception_handler.py +61 -0
  158. spring/web/health.py +399 -0
  159. spring/web/interceptor.py +91 -0
  160. spring/web/result.py +44 -0
  161. spring/web/swagger.py +601 -0
  162. spring/web/web_context.py +755 -0
  163. spring/websocket/__init__.py +86 -0
  164. spring/websocket/annotations.py +169 -0
  165. spring/websocket/broker.py +238 -0
  166. spring/websocket/exceptions.py +26 -0
  167. spring/websocket/handler.py +243 -0
  168. spring/websocket/router.py +526 -0
  169. spring/websocket/session.py +216 -0
  170. springbootai-1.8.0.dist-info/METADATA +2796 -0
  171. springbootai-1.8.0.dist-info/RECORD +175 -0
  172. springbootai-1.8.0.dist-info/WHEEL +5 -0
  173. springbootai-1.8.0.dist-info/entry_points.txt +2 -0
  174. springbootai-1.8.0.dist-info/licenses/LICENSE +7 -0
  175. 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