mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-03-09 12:31:39 +00:00
* Remove `libsql_module` field from `sqlite3_vtab` * remove `libsql_module` struct Also removed the associated functions `libsql_create_module_v2`, `libsql_create_module` functions'. The `libsql_module` had a function `xPreparedSql` which is now moved to `sqlite_module`. The `sqlite_module` might get changed in the upstream, so added some padding space for our custom functions * generate ffi bindings * Add a github workflow to test crsqlite * fix crsqlite: remove `pLibsqlModule` references * Add tests for sqlite-vss extension
18 lines
723 B
Rust
18 lines
723 B
Rust
use libsql_sys::rusqlite::{Connection, params, LoadExtensionGuard};
|
|
|
|
#[test]
|
|
fn test_sqlite_vss() {
|
|
let conn = Connection::open_in_memory().unwrap();
|
|
unsafe {
|
|
let _guard = LoadExtensionGuard::new(&conn).unwrap();
|
|
conn.load_extension("src/vector0", None).unwrap();
|
|
conn.load_extension("src/vss0", None).unwrap();
|
|
}
|
|
conn.execute("CREATE VIRTUAL TABLE IF NOT EXISTS vss_demo USING vss0(a(2))", ())
|
|
.unwrap();
|
|
conn.execute("INSERT INTO vss_demo(rowid, a) VALUES (1, '[1.0, 2.0]'), (2, '[2.0, 2.0]'), (3, '[3.0, 2.0]')", ()).unwrap();
|
|
conn.execute(
|
|
"SELECT rowid, distance FROM vss_demo WHERE vss_search(?, ?) LIMIT 3",
|
|
params![1.0, 2.0],
|
|
).unwrap();
|
|
} |