Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hfhbd/sqldelight-writer
https://github.com/hfhbd/sqldelight-writer
sqldelight
Last synced: about 4 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/hfhbd/sqldelight-writer
- Owner: hfhbd
- License: apache-2.0
- Created: 2022-10-09T21:23:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-13T16:28:16.000Z (6 days ago)
- Last Synced: 2024-11-13T17:29:49.444Z (6 days ago)
- Topics: sqldelight
- Language: Kotlin
- Homepage:
- Size: 288 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# SqlDelight-Writer
Simple DSL to write SqlDelight files
## Install
This package is uploaded to MavenCentral.
```kotlin
repositories {
mavenCentral()
}dependencies {
implementation("app.softwork:sqldelight-writer:LATEST")
}
```## Usage
```kotlin
val files = writeSq(packageName = "sample") {
migrationFile(version = 1) {
+"""
|CREATE TABLE bar(
|id INTEGER
|);
""".trimMargin()
}
queryFile(name = "Sql") {
import("kotlin.Int")+"""
|CREATE TABLE bar(
|id INTEGER AS Int
|);
""".trimMargin()query(name = "get") {
+"""
|SELECT * FROM bar;
""".trimMargin()
}
query(name = "multi") {
+"SELECT * FROM bar;"
+"SELECT * FROM bar;"
}
}
}
files.writeTo(folder)
```