https://github.com/sake92/mill-squery
https://github.com/sake92/mill-squery
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/sake92/mill-squery
- Owner: sake92
- License: apache-2.0
- Created: 2025-07-14T10:19:54.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-16T13:52:19.000Z (about 1 year ago)
- Last Synced: 2025-10-11T10:58:07.144Z (10 months ago)
- Language: Shell
- Size: 731 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mill-squery
Mill plugin for Squery.
Generates models and DAOs automatically from db.
And incrementally refactors them via regenesca.
```scala
//| mill-version: 1.0.0
//| mvnDeps:
//| - "ba.sake::mill-squery-generator::0.8.0"
//| - "com.lihaoyi::mill-contrib-flyway:1.0.0"
package build
object myapp extends ScalaModule, SqueryGeneratorModule {
def squeryJdbcUrl = "jdbc:h2:..."
def squeryJdbcDeps = Seq(mvn"com.h2database:h2:...")
// mappings from db schema to package name
def squerySchemaMappings = Seq("PUBLIC" -> "com.myapp.public")
// optional config
// def squeryColNameIdentifierMapper = "camelcase" // or "noop"
// def squeryTypeNameMapper = "camelcase" // or "noop"
// def squeryRowTypeSuffix = "Row"
// def squeryDaoTypeSuffix = "Dao"
// def squeryTargetDir: T[PathRef] = Task {
// BuildCtx.withFilesystemCheckerDisabled(PathRef(moduleDir / "src"))
// }
// def squeryVersion = "0.8.1" // squery version used to generate sources
```
Generate source files whenever you change the openapi.json file:
```shell
./mill -i myapp.squeryGenerate
```