File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
src/main/sqldelight/dev/hossain/postgresqldelight Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 11plugins {
22 kotlin(" jvm" ) version " 1.9.0"
3+
4+ // SQLDelight - Generates typesafe Kotlin APIs from SQL
5+ // https://cashapp.github.io/sqldelight/2.0.0/
6+ id(" app.cash.sqldelight" ) version " 2.0.0"
7+
38 application
49}
510
611group = " dev.hossain.postgresqldelight"
712version = " 1.0-SNAPSHOT"
813
914repositories {
15+ google()
1016 mavenCentral()
1117}
1218
19+ // SQLDelight - Generates typesafe Kotlin APIs from SQL
20+ // https://github.com/cashapp/sqldelight
21+ sqldelight {
22+ databases {
23+ create(" SportsDatabase" ) {
24+ packageName.set(" dev.hossain.githubstats" )
25+ // https://cashapp.github.io/sqldelight/2.0.0/jvm_postgresql/
26+ dialect(" app.cash.sqldelight:postgresql-dialect:2.0.0" )
27+
28+ }
29+ }
30+ }
31+
1332dependencies {
33+ // PostgreSQL is a powerful object-relational database system
34+ // https://www.postgresql.org/
35+ // https://mvnrepository.com/artifact/org.postgresql/postgresql
36+ implementation(" org.postgresql:postgresql:42.6.0" )
37+
38+ // 光 HikariCP・A solid, high-performance, JDBC connection pool at last.
39+ // https://github.com/brettwooldridge/HikariCP#artifacts
40+ // https://www.baeldung.com/hikaricp
41+ implementation(" com.zaxxer:HikariCP:5.0.1" )
42+
43+ // SQLDelight - Generates typesafe Kotlin APIs from SQL
44+ // https://cashapp.github.io/sqldelight/2.0.0/jvm_postgresql
45+ implementation(" app.cash.sqldelight:jdbc-driver:2.0.0" )
46+
1447 testImplementation(kotlin(" test" ))
1548}
1649
Original file line number Diff line number Diff line change 1+ CREATE TABLE hockeyPlayer (
2+ player_number INTEGER PRIMARY KEY NOT NULL,
3+ full_name TEXT NOT NULL
4+ );
5+
6+ CREATE INDEX hockeyPlayer_full_name ON hockeyPlayer(full_name);
7+
8+ INSERT INTO hockeyPlayer (player_number, full_name)
9+ VALUES (15, 'Ryan Getzlaf');
10+
11+ selectAll:
12+ SELECT *
13+ FROM hockeyPlayer;
14+
15+ insert:
16+ INSERT INTO hockeyPlayer(player_number, full_name)
17+ VALUES (?, ?);
18+
19+ insertFullPlayerObject:
20+ INSERT INTO hockeyPlayer(player_number, full_name)
21+ VALUES ?;
You can’t perform that action at this time.
0 commit comments