Skip to content

Commit ced658e

Browse files
committed
upgrade turso and add support for index methods
1 parent 340e5b7 commit ced658e

File tree

5 files changed

+86
-66
lines changed

5 files changed

+86
-66
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ path = "rs_src/lib.rs"
1414
env_logger = { version = "0.11.6", default-features = false }
1515
tracing = "0.1.41"
1616
tracing-appender = "0.2.3"
17-
tracing-subscriber = {version = "0.3.20", features = ["env-filter"] }
18-
turso_core = { version = "0.2.0" }
17+
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
18+
turso_core = { git = "https://github.com/tursodatabase/turso", rev = "a47ac6cb96fbfcbaa19ee1d4eeb2fe8b54803901" }

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0270d9e1
1+
340e5b76

rs_src/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use std::{
77
sync::{Arc, OnceLock},
88
};
99
extern crate turso_core;
10-
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
11-
use turso_core::{Connection, LimboError};
10+
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
11+
use turso_core::{Connection, DatabaseOpts, LimboError};
1212

1313
use crate::types::ResultCode;
1414

@@ -27,13 +27,10 @@ pub unsafe extern "C" fn db_open(path: *const c_char) -> *mut c_void {
2727
let path = unsafe { std::ffi::CStr::from_ptr(path) };
2828
let path = path.to_str().unwrap();
2929
let _ = init_tracing();
30-
let indexes = true;
31-
let mvcc = false;
32-
let encryption = false;
33-
let views = false;
34-
let strict = false;
35-
let Ok((io, conn)) = Connection::from_uri(path, indexes, mvcc, views, strict, encryption)
36-
else {
30+
let opts = DatabaseOpts::new()
31+
.with_indexes(true)
32+
.with_index_method(true);
33+
let Ok((io, conn)) = Connection::from_uri(path, opts) else {
3734
panic!("Failed to open connection with path: {path}");
3835
};
3936
TursoConn::new(conn, io).to_ptr()

turso_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,6 @@ func TestUpsertReturning_databaseSQL_Prepared_ArgCountMismatch(t *testing.T) {
10611061
t.Fatal("expected argument count error, got nil")
10621062
}
10631063
}
1064-
10651064
func TestMultiStatementExecution(t *testing.T) {
10661065
db := openMem(t)
10671066

@@ -1213,3 +1212,15 @@ func TestMultiStatementExecution(t *testing.T) {
12131212
}
12141213
})
12151214
}
1215+
1216+
func TestIndexMethod(t *testing.T) {
1217+
db := openMem(t)
1218+
_, err := db.Exec(`CREATE TABLE vectors (e)`)
1219+
if err != nil {
1220+
t.Fatalf("Failed to create table: %v", err)
1221+
}
1222+
_, err = db.Exec(`CREATE INDEX vectors_idx ON vectors USING toy_vector_sparse_ivf (e)`)
1223+
if err != nil {
1224+
t.Fatalf("Failed to create table: %v", err)
1225+
}
1226+
}

0 commit comments

Comments
 (0)