Skip to content

Commit 8f0da8a

Browse files
committed
Update README.md
1 parent eb02f64 commit 8f0da8a

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

README.md

+25-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
![BUILD](https://github.com/wojta/sqldelight-node-sqlite3-driver/actions/workflows/build.yml/badge.svg) [![stability-experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#experimental)
22
[![Maven Central](https://img.shields.io/maven-central/v/cz.sazel.sqldelight/node-sqlite3-driver-js?color=blue)](https://search.maven.org/search?q=g:cz.sazel.sqldelight)
33

4+
# sqldelight-node-sqlite3-driver
5+
6+
Driver for the library [SQLDelight](https://github.com/cashapp/sqldelight) that
7+
supports [sqlite3](https://www.npmjs.com/package/sqlite3) Node.js module
48

5-
# sqldelight-node-sqlite3-driver
6-
Driver for the library [SQLDelight](https://github.com/cashapp/sqldelight) that supports [sqlite3](https://www.npmjs.com/package/sqlite3) Node.js module
79
* example here: https://github.com/wojta/example-sqldelight-node-sqlite3-driver
810

911
## [API KDoc](https://wojta.github.io/sqldelight-node-sqlite3-driver/)
1012

11-
## Gradle set up
13+
## Gradle set up
1214

13-
Pretty much it's almost the same as with https://cashapp.github.io/sqldelight/2.0.0/js_sqlite/
15+
Pretty much it's almost the same as with https://sqldelight.github.io/sqldelight/2.0.2/js_sqlite
1416

1517
Initialization of SQLDelight is needed
1618

1719
```kotlin
1820
plugins {
19-
kotlin("js") version "1.9.20" // probably would work even with different one
20-
id("app.cash.sqldelight") version "2.0.0" // for version 0.3.0
21+
kotlin("js") version "2.1.20" // probably would work even with different one
22+
id("app.cash.sqldelight") version "2.0.2" // for version 0.4.0 and higher
2123
}
2224
2325
@@ -40,7 +42,7 @@ kotlin {
4042
binaries.executable()
4143
nodejs {
4244
dependencies {
43-
implementation("cz.sazel.sqldelight:node-sqlite3-driver-js:0.3.0")
45+
implementation("cz.sazel.sqldelight:node-sqlite3-driver-js:0.4.1")
4446
}
4547
}
4648
}
@@ -53,18 +55,17 @@ in the `sqlite3` node package directory. It needs to run `yarn` first to downloa
5355
```kotlin
5456
val bindingsInstall = tasks.register("sqlite3BindingsInstall") {
5557
doLast {
56-
val sqlite3moduleDir = buildDir.resolve("js/node_modules/sqlite3")
57-
if (!sqlite3moduleDir.resolve("lib/binding").exists()) {
58+
val sqlite3moduleDir = layout.buildDirectory.get().dir("js/node_modules/sqlite3").asFile
59+
if (!sqlite3moduleDir.resolve("build").exists()) {
5860
exec {
5961
workingDir = sqlite3moduleDir
60-
val yarnPath="${yarn.yarnSetupTaskProvider.get().destination.absolutePath}/bin"
61-
val nodePath="${kotlinNodeJsExtension.nodeJsSetupTaskProvider.get().destination.absolutePath}/bin"
62+
val yarnExecutable = yarn.environment.executable
63+
val yarnPath = file(yarnExecutable).parent
64+
val nodePath = file(kotlinNodeJsEnvSpec.executable).parent
6265
environment(
63-
"PATH",
64-
System.getenv("PATH") + ":$yarnPath:$nodePath"
66+
"PATH", System.getenv("PATH") + ":$yarnPath:$nodePath"
6567
)
66-
var commandLine = "$yarnPath/yarn"
67-
commandLine(commandLine)
68+
commandLine(yarnExecutable)
6869
}
6970
}
7071
}
@@ -74,10 +75,7 @@ tasks["kotlinNpmInstall"].finalizedBy(bindingsInstall)
7475

7576
## Simple example
7677

77-
78-
79-
Queries are written as here - https://cashapp.github.io/sqldelight/2.0.0/js_sqlite/
80-
78+
Queries are written as here - https://sqldelight.github.io/sqldelight/2.0.2/js_sqlite/#using-queries
8179

8280
```kotlin
8381
suspend fun main() {
@@ -99,15 +97,19 @@ suspend fun main() {
9997
}
10098
```
10199

102-
Note: Please use `executeSuspendingAsList()` in queries instead of `executeAsList()` as that API is not suspending and will throw an exception with this driver.
103-
100+
Note: Please use `executeSuspendingAsList()` or `executeAsFlow()` in queries instead of `executeAsList()`
101+
as that API is not suspending and will throw an exception with this driver.
104102

105103
## Thanks
106-
To _Isuru Rajapakse_ and the project [KStore](https://github.com/xxfast/KStore) which is an inspiration for the set-up of publishing in Gradle scripts.
107104

108-
To authors of SQLDelight, implementation is based on the [sqljs](https://github.com/sql-js/sql.js/) implementation of the driver which is already included in the library.s.
105+
To _Isuru Rajapakse_ and the project [KStore](https://github.com/xxfast/KStore) which is an inspiration for the set-up
106+
of publishing in Gradle scripts.
107+
108+
To authors of SQLDelight, implementation is based on the [sqljs](https://github.com/sql-js/sql.js/) implementation of
109+
the driver which is already included in the library.s.
109110

110111
## License
112+
111113
Licensed under the Apache License, Version 2.0 (the "License");
112114
you may not use this file except in compliance with the License.
113115
You may obtain a copy of the License at

0 commit comments

Comments
 (0)