Skip to content

Commit 35baa1d

Browse files
authored
Merge pull request #128 from tursodatabase/fix_110
Allow read your writes configuration
2 parents e21804d + 76931a4 commit 35baa1d

File tree

6 files changed

+81
-78
lines changed

6 files changed

+81
-78
lines changed

Cargo.lock

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212

1313
[dependencies]
1414
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
15-
libsql = { git = "https://github.com/tursodatabase/libsql/", rev = "8a8a897833ec98a6201d22d5c5cf803cd57f98c6", features = ["encryption"] }
15+
libsql = { git = "https://github.com/tursodatabase/libsql", features = ["encryption"] }
1616
tracing = "0.1"
1717
once_cell = "1.18.0"
1818
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class Database {
7373
}
7474
const encryptionKey = opts?.encryptionKey ?? "";
7575
const syncPeriod = opts?.syncPeriod ?? 0.0;
76-
this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod);
76+
const readYourWrites = opts?.readYourWrites ?? true;
77+
this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod, readYourWrites);
7778
} else {
7879
const authToken = opts?.authToken ?? "";
7980
const encryptionKey = opts?.encryptionKey ?? "";

package-lock.json

Lines changed: 67 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@
6868
"dependencies": {
6969
"@neon-rs/load": "^0.0.4",
7070
"detect-libc": "2.0.2",
71-
"libsql": "^0.3.15"
71+
"libsql": "^0.3.19"
7272
}
7373
}

src/database.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impl Database {
6767
let encryption_cipher = cx.argument::<JsString>(3)?.value(&mut cx);
6868
let encryption_key = cx.argument::<JsString>(4)?.value(&mut cx);
6969
let sync_period = cx.argument::<JsNumber>(5)?.value(&mut cx);
70+
let read_your_writes = cx.argument::<JsBoolean>(6)?.value(&mut cx);
7071

7172
let cipher = libsql::Cipher::from_str(&encryption_cipher).or_else(|err| {
7273
throw_libsql_error(
@@ -98,7 +99,7 @@ impl Database {
9899
sync_url,
99100
sync_auth,
100101
Some(version),
101-
true,
102+
read_your_writes,
102103
encryption_config,
103104
sync_period,
104105
);

0 commit comments

Comments
 (0)