Skip to content

Commit

Permalink
Port kotlin examples to sqlc-gen-kotlin (sqlc-dev#1931)
Browse files Browse the repository at this point in the history
* Update sqlc.json

* Development build

* kotlin: Upgrade to v1.0.0
  • Loading branch information
kyleconroy authored and akutschera committed Nov 10, 2022
1 parent d6c76e8 commit 94001bd
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 32 deletions.
8 changes: 4 additions & 4 deletions docs/guides/migrating-to-sqlc-gen-kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ already. Add the following configuration for the plugin:
{
"name": "kt",
"wasm": {
"url": "https://downloads.sqlc.dev/plugins/sqlc-gen-kotlin_0.16.0.wasm",
"sha256": "FIXME"
"url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm",
"sha256": "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
}
}
]
Expand All @@ -35,8 +35,8 @@ version: "2"
plugins:
name: "kt"
wasm:
url: "https://downloads.sqlc.dev/plugins/sqlc-gen-kotlin_0.16.0.wasm"
sha256: "FIXME"
url: "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm"
sha256: "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
```

## Migrate each package
Expand Down
86 changes: 58 additions & 28 deletions examples/kotlin/sqlc.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,112 @@
{
"version": "2",
"plugins": [
{
"name": "kt",
"wasm": {
"url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm",
"sha256": "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
}
}
],
"sql": [
{
"schema": "src/main/resources/authors/postgresql/schema.sql",
"queries": "src/main/resources/authors/postgresql/query.sql",
"engine": "postgresql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/authors/postgresql",
"package": "com.example.authors.postgresql"
"plugin": "kt",
"options": {
"package": "com.example.authors.postgresql"
}
}
}
]
},
{
"schema": "src/main/resources/ondeck/postgresql/schema",
"queries": "src/main/resources/ondeck/postgresql/query",
"engine": "postgresql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/ondeck/postgresql",
"package": "com.example.ondeck.postgresql"
"plugin": "kt",
"options": {
"package": "com.example.ondeck.postgresql"
}
}
}
]
},
{
"schema": "src/main/resources/jets/schema.sql",
"queries": "src/main/resources/jets/query-building.sql",
"engine": "postgresql",
"gen": {
"kotlin": {
"codegen": [
{
"plugin": "kt",
"out": "src/main/kotlin/com/example/jets",
"package": "com.example.jets"
"options": {
"package": "com.example.jets"
}
}
}
]
},
{
"schema": "src/main/resources/booktest/postgresql/schema.sql",
"queries": "src/main/resources/booktest/postgresql/query.sql",
"engine": "postgresql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/booktest/postgresql",
"package": "com.example.booktest.postgresql"
"plugin": "kt",
"options": {
"package": "com.example.booktest.postgresql"
}
}
}
]
},
{
"schema": "src/main/resources/authors/mysql/schema.sql",
"queries": "src/main/resources/authors/mysql/query.sql",
"engine": "mysql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/authors/mysql",
"package": "com.example.authors.mysql"
"plugin": "kt",
"options": {
"package": "com.example.authors.mysql"
}
}
}
]
},
{
"schema": "src/main/resources/booktest/mysql/schema.sql",
"queries": "src/main/resources/booktest/mysql/query.sql",
"engine": "mysql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/booktest/mysql",
"package": "com.example.booktest.mysql"
"plugin": "kt",
"options": {
"package": "com.example.booktest.mysql"
}
}
}
]
},
{
"schema": "src/main/resources/ondeck/mysql/schema",
"queries": "src/main/resources/ondeck/mysql/query",
"engine": "mysql",
"gen": {
"kotlin": {
"codegen": [
{
"out": "src/main/kotlin/com/example/ondeck/mysql",
"package": "com.example.ondeck.mysql"
"plugin": "kt",
"options": {
"package": "com.example.ondeck.mysql"
}
}
}
]
}
]
}

0 comments on commit 94001bd

Please sign in to comment.