[feat] 拓展 database-ptc-object 增加快捷操作工具#657
Closed
FxRayHughes wants to merge 2 commits intoTabooLib:dev/6.2.3from
Closed
[feat] 拓展 database-ptc-object 增加快捷操作工具#657FxRayHughes wants to merge 2 commits intoTabooLib:dev/6.2.3from
FxRayHughes wants to merge 2 commits intoTabooLib:dev/6.2.3from
Conversation
- 新增 ColumnType 注解支持自定义 SQL 和 SQLite 列类型 - 添加 findByKey、findOneByKey、hasByKey 等基于 @id + @key 的操作方法 - 实现批量操作 findByIds、deleteByIds 和 updateBatch - 增加通过自增行 ID 查询和删除的功能 - 添加事务上下文中的 insert、update、delete 方法 - 扩展 JoinQuery 支持 selectAs 列别名功能 - 引入 DataMapper 接口及其实现提供类型安全的 CRUD 操作 - 添加插入数据并返回自增主键的功能 - 实现按条件删除和统计数量的方法 - 增强缓存失效策略支持更精确的缓存管理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为
database-ptc-object模块新增快捷操作工具,简化数据库 CRUD 操作流程。主要改动
新增功能
@ColumnType注解 — 显式指定数据库列类型(LONGTEXT、TEXT 等)mapper<T>()属性委托 — 一行代码懒加载创建容器 + 表 + 操作器DataMapper<T>接口 — 类型安全的 CRUD 入口(insert/find/update/delete/count/exists/sort 等)DataCache接口 — 可扩展的查询缓存,支持自定义实现(Redis、Caffeine 等),内置 ConcurrentHashMap 实现findByIds、deleteByIds、updateBatch(IN 子句 + batch PreparedStatement)query、rawQuery、rawUpdate、rawDelete、rawExecutejoin {}+selectAs()解决同名列冲突transaction {}块内共享连接insertAndGetKey/insertBatchAndGetKeysfindByKey、deleteByKey、existsByKeyfindByRowId、deleteByRowId(用于无 @id 的数据类)补充 ContainerOperator
count()、deleteWhere()、insertAndGetKeys()、findByIds()、deleteByIds()、updateBatch()、findByKey()、deleteByKey()等方法修改的文件
Annotations.kt— 新增@ColumnType,补充注解文档AnalyzedClassMember.kt— 解析@ColumnTypeContainerSQL.kt/ContainerSQLite.kt— 支持@ColumnType建表ContainerOperator.kt/ContainerOperatorImpl.kt— 新增基础方法JoinQuery.kt— 新增selectAs()PersistentContainer.kt— 新增mapper()TransactionContext.kt— 新增快捷方法新建的文件
DataMapper.kt— CRUD 接口定义DataMapperImpl.kt— 标准实现(含精确缓存失效)TransactionalDataMapper.kt— 事务实现QueryCache.kt—DataCache接口 + 内置 ConcurrentHashMap 缓存MapperDelegate.kt—mapper<T>()属性委托工厂用法示例
Closes #656