Skip to content

Commit e594032

Browse files
committed
Support disabling read-your-writes
1 parent f49cf23 commit e594032

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface Options {
88
timeout?: number
99
authToken?: string
1010
syncUrl?: string
11+
readYourWrites?: boolean
1112
syncPeriod?: number
1213
encryptionCipher?: string
1314
encryptionKey?: string

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ pub struct Options {
190190
pub authToken: Option<String>,
191191
// URL for remote database sync.
192192
pub syncUrl: Option<String>,
193+
// Read your writes.
194+
pub readYourWrites: Option<bool>,
193195
// Sync interval in seconds.
194196
pub syncPeriod: Option<f64>,
195197
// Encryption cipher for local enryption at rest.
@@ -286,6 +288,9 @@ impl Database {
286288
let mut builder =
287289
libsql::Builder::new_remote_replica(path.clone(), sync_url.clone(), auth_token);
288290

291+
let read_your_writes = options.readYourWrites.unwrap_or(true);
292+
builder = builder.read_your_writes(read_your_writes);
293+
289294
if encryption_key.len() > 0 {
290295
let encryption_config =
291296
libsql::EncryptionConfig::new(cipher, encryption_key.into());

0 commit comments

Comments
 (0)