Skip to content

Commit 5a927f3

Browse files
authored
Port kotlin examples to sqlc-gen-kotlin (#1931)
* Update sqlc.json * Development build * kotlin: Upgrade to v1.0.0
1 parent 8c070d0 commit 5a927f3

File tree

2 files changed

+62
-32
lines changed

2 files changed

+62
-32
lines changed

docs/guides/migrating-to-sqlc-gen-kotlin.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ already. Add the following configuration for the plugin:
2222
{
2323
"name": "kt",
2424
"wasm": {
25-
"url": "https://downloads.sqlc.dev/plugins/sqlc-gen-kotlin_0.16.0.wasm",
26-
"sha256": "FIXME"
25+
"url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm",
26+
"sha256": "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
2727
}
2828
}
2929
]
@@ -35,8 +35,8 @@ version: "2"
3535
plugins:
3636
name: "kt"
3737
wasm:
38-
url: "https://downloads.sqlc.dev/plugins/sqlc-gen-kotlin_0.16.0.wasm"
39-
sha256: "FIXME"
38+
url: "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm"
39+
sha256: "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
4040
```
4141
4242
## Migrate each package

examples/kotlin/sqlc.json

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,112 @@
11
{
22
"version": "2",
3+
"plugins": [
4+
{
5+
"name": "kt",
6+
"wasm": {
7+
"url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm",
8+
"sha256": "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c"
9+
}
10+
}
11+
],
312
"sql": [
413
{
514
"schema": "src/main/resources/authors/postgresql/schema.sql",
615
"queries": "src/main/resources/authors/postgresql/query.sql",
716
"engine": "postgresql",
8-
"gen": {
9-
"kotlin": {
17+
"codegen": [
18+
{
1019
"out": "src/main/kotlin/com/example/authors/postgresql",
11-
"package": "com.example.authors.postgresql"
20+
"plugin": "kt",
21+
"options": {
22+
"package": "com.example.authors.postgresql"
23+
}
1224
}
13-
}
25+
]
1426
},
1527
{
1628
"schema": "src/main/resources/ondeck/postgresql/schema",
1729
"queries": "src/main/resources/ondeck/postgresql/query",
1830
"engine": "postgresql",
19-
"gen": {
20-
"kotlin": {
31+
"codegen": [
32+
{
2133
"out": "src/main/kotlin/com/example/ondeck/postgresql",
22-
"package": "com.example.ondeck.postgresql"
34+
"plugin": "kt",
35+
"options": {
36+
"package": "com.example.ondeck.postgresql"
37+
}
2338
}
24-
}
39+
]
2540
},
2641
{
2742
"schema": "src/main/resources/jets/schema.sql",
2843
"queries": "src/main/resources/jets/query-building.sql",
2944
"engine": "postgresql",
30-
"gen": {
31-
"kotlin": {
45+
"codegen": [
46+
{
47+
"plugin": "kt",
3248
"out": "src/main/kotlin/com/example/jets",
33-
"package": "com.example.jets"
49+
"options": {
50+
"package": "com.example.jets"
51+
}
3452
}
35-
}
53+
]
3654
},
3755
{
3856
"schema": "src/main/resources/booktest/postgresql/schema.sql",
3957
"queries": "src/main/resources/booktest/postgresql/query.sql",
4058
"engine": "postgresql",
41-
"gen": {
42-
"kotlin": {
59+
"codegen": [
60+
{
4361
"out": "src/main/kotlin/com/example/booktest/postgresql",
44-
"package": "com.example.booktest.postgresql"
62+
"plugin": "kt",
63+
"options": {
64+
"package": "com.example.booktest.postgresql"
65+
}
4566
}
46-
}
67+
]
4768
},
4869
{
4970
"schema": "src/main/resources/authors/mysql/schema.sql",
5071
"queries": "src/main/resources/authors/mysql/query.sql",
5172
"engine": "mysql",
52-
"gen": {
53-
"kotlin": {
73+
"codegen": [
74+
{
5475
"out": "src/main/kotlin/com/example/authors/mysql",
55-
"package": "com.example.authors.mysql"
76+
"plugin": "kt",
77+
"options": {
78+
"package": "com.example.authors.mysql"
79+
}
5680
}
57-
}
81+
]
5882
},
5983
{
6084
"schema": "src/main/resources/booktest/mysql/schema.sql",
6185
"queries": "src/main/resources/booktest/mysql/query.sql",
6286
"engine": "mysql",
63-
"gen": {
64-
"kotlin": {
87+
"codegen": [
88+
{
6589
"out": "src/main/kotlin/com/example/booktest/mysql",
66-
"package": "com.example.booktest.mysql"
90+
"plugin": "kt",
91+
"options": {
92+
"package": "com.example.booktest.mysql"
93+
}
6794
}
68-
}
95+
]
6996
},
7097
{
7198
"schema": "src/main/resources/ondeck/mysql/schema",
7299
"queries": "src/main/resources/ondeck/mysql/query",
73100
"engine": "mysql",
74-
"gen": {
75-
"kotlin": {
101+
"codegen": [
102+
{
76103
"out": "src/main/kotlin/com/example/ondeck/mysql",
77-
"package": "com.example.ondeck.mysql"
104+
"plugin": "kt",
105+
"options": {
106+
"package": "com.example.ondeck.mysql"
107+
}
78108
}
79-
}
109+
]
80110
}
81111
]
82112
}

0 commit comments

Comments
 (0)