Skip to content

Commit e919712

Browse files
authored
Merge pull request #126 from tursodatabase/vector-version-update
0.4.0-pre.9
2 parents cdb5887 + 13e520f commit e919712

File tree

5 files changed

+35
-13
lines changed

5 files changed

+35
-13
lines changed

Cargo.lock

Lines changed: 8 additions & 8 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
@@ -1,6 +1,6 @@
11
[package]
22
name = "libsql-js"
3-
version = "0.4.0-pre.8"
3+
version = "0.4.0-pre.9"
44
description = ""
55
authors = ["Pekka Enberg <penberg@iki.fi>"]
66
license = "MIT"
@@ -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 = "dd548a902b56cc5b9daa3cec7a43ca887ea81136", features = ["encryption"] }
15+
libsql = { git = "https://github.com/tursodatabase/libsql/", rev = "7b8bb905ab19f8988ace702d025361e6b6d7c377", features = ["encryption"] }
1616
tracing = "0.1"
1717
once_cell = "1.18.0"
1818
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }

integration-tests/tests/sync.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,28 @@ test.serial("Statement.run() with Float32Array bind parameter", async (t) => {
225225
t.deepEqual(selectStmt.raw().get()[0], Buffer.from(array.buffer));
226226
});
227227

228+
test.serial("Statement.run() for vector feature with Float32Array bind parameter", async (t) => {
229+
if (t.context.provider === 'sqlite') {
230+
// skip this test for sqlite
231+
t.assert(true);
232+
return;
233+
}
234+
const db = t.context.db;
235+
236+
db.exec(`
237+
DROP TABLE IF EXISTS t;
238+
CREATE TABLE t (embedding FLOAT32(8));
239+
CREATE INDEX t_idx ON t ( libsql_vector_idx(embedding) );
240+
`);
241+
242+
const insertStmt = db.prepare("INSERT INTO t VALUES (?)");
243+
insertStmt.run([new Float32Array([1,1,1,1,1,1,1,1])]);
244+
insertStmt.run([new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1])]);
245+
246+
const selectStmt = db.prepare("SELECT embedding FROM vector_top_k('t_idx', vector('[2,2,2,2,2,2,2,2]'), 1) n JOIN t ON n.rowid = t.rowid");
247+
t.deepEqual(selectStmt.raw().get()[0], Buffer.from(new Float32Array([1,1,1,1,1,1,1,1]).buffer));
248+
});
249+
228250
test.serial("Statement.columns()", async (t) => {
229251
const db = t.context.db;
230252

package-lock.json

Lines changed: 2 additions & 2 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
@@ -1,6 +1,6 @@
11
{
22
"name": "libsql",
3-
"version": "0.4.0-pre.8",
3+
"version": "0.4.0-pre.9",
44
"description": "A better-sqlite3 compatible API for libSQL that supports Bun, Deno, and Node",
55
"os": [
66
"darwin",

0 commit comments

Comments
 (0)