Skip to content

Commit e37bcd5

Browse files
committed
[ADDED] Necessary dependencies to the test app
1 parent 72eb3be commit e37bcd5

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

build.gradle.kts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,49 @@
11
plugins {
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

611
group = "dev.hossain.postgresqldelight"
712
version = "1.0-SNAPSHOT"
813

914
repositories {
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+
1332
dependencies {
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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 ?;

0 commit comments

Comments
 (0)