Agent skill · software engineering · affaan-m
kotlin-exposed-patterns
JetBrains Exposed ORM 模式,包括 DSL 查询、DAO 模式、事务、HikariCP 连接池、Flyway 迁移和仓库模式。
Why this skill is useful
Adds executable scripts and detailed patterns for using JetBrains Exposed ORM with HikariCP and Flyway that are not commonly found in public documentation.
What it needs
Requires flyway, hikari installed locally. About 7k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.
What this skill does
Kotlin Exposed 模式 使用 JetBrains Exposed ORM 进行数据库访问的全面模式,包括 DSL 查询、DAO、事务以及生产就绪的配置。 何时使用 使用 Exposed 设置数据库访问 使用 Exposed DSL 或 DAO 编写 SQL 查询 使用 HikariCP 配置连接池 使用 Flyway 创建数据库迁移 使用 Exposed 实现仓储模式 处理 JSON 列和复杂查询 工作原理 Exposed 提供两种查询风格:用于直接类似 SQL 表达式的 DSL 和用于实体生命周期管理的 DAO。HikariCP 通过 HikariConfig 配置来管理可重用的数据库连接池。Flyway 在启动时运行版本化的 SQL 迁移脚本以保持模式同步。所有数据库操作都在 newSuspendedTransaction 块内运行,以确保协程安全和原子性。仓储模式将 Exposed 查询包装在接口之后,使业务逻辑与数据层解耦,并且测试可以使用内存中的 H2 数据库。 示例 DSL 查询 DAO 实体用法 HikariCP 配置 数据库设置 HikariCP 连接池 Flyway 迁移 迁移文件 表定义 DSL 风格表 复合表 DSL 查询 基本 CRUD 高级查询 分页 批量操作 DAO 模式 实体定义 DAO 操作 事务 挂起事务支持 事务隔离级别 仓储模式 接口定义 Exposed 实现 JSON 列 使用 kotlinx.serialization 的 JSONB 使用 Exposed 进行测试 用于测试的内存数据库 Gradle 依赖项 `kotlin // build.gradle.kts dependencies { // Exposed implementation("org.jetbrains.exposed:exposed-core:1.0.0") implementation("org.jetbrains.exposed:exposed-dao:1.0.0") implementation("org.jetbrains.exposed:exposed-jdbc:1.0.0") implementation("org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0") implementation("org.jetbrains.exposed:exposed-json:1.0.0") // Database driver implementation("org.postgresql:postgresql:42.7.5") // Connection pooling implementation("com.zaxxer:HikariCP:6.2.1") // Migrations implementation("org.flywaydb:flyway-core:10.22.0") imple
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills affaan-m/kotlin-exposed-patterns--4c29f0