Skip to content

Commit

Permalink
Merge pull request #126 from tursodatabase/vector-version-update
Browse files Browse the repository at this point in the history
0.4.0-pre.9
  • Loading branch information
sivukhin authored Jul 5, 2024
2 parents cdb5887 + 13e520f commit e919712
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libsql-js"
version = "0.4.0-pre.8"
version = "0.4.0-pre.9"
description = ""
authors = ["Pekka Enberg <penberg@iki.fi>"]
license = "MIT"
Expand All @@ -12,7 +12,7 @@ crate-type = ["cdylib"]

[dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
libsql = { git = "https://github.com/tursodatabase/libsql/", rev = "dd548a902b56cc5b9daa3cec7a43ca887ea81136", features = ["encryption"] }
libsql = { git = "https://github.com/tursodatabase/libsql/", rev = "7b8bb905ab19f8988ace702d025361e6b6d7c377", features = ["encryption"] }
tracing = "0.1"
once_cell = "1.18.0"
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }
Expand Down
22 changes: 22 additions & 0 deletions integration-tests/tests/sync.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,28 @@ test.serial("Statement.run() with Float32Array bind parameter", async (t) => {
t.deepEqual(selectStmt.raw().get()[0], Buffer.from(array.buffer));
});

test.serial("Statement.run() for vector feature with Float32Array bind parameter", async (t) => {
if (t.context.provider === 'sqlite') {
// skip this test for sqlite
t.assert(true);
return;
}
const db = t.context.db;

db.exec(`
DROP TABLE IF EXISTS t;
CREATE TABLE t (embedding FLOAT32(8));
CREATE INDEX t_idx ON t ( libsql_vector_idx(embedding) );
`);

const insertStmt = db.prepare("INSERT INTO t VALUES (?)");
insertStmt.run([new Float32Array([1,1,1,1,1,1,1,1])]);
insertStmt.run([new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1])]);

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");
t.deepEqual(selectStmt.raw().get()[0], Buffer.from(new Float32Array([1,1,1,1,1,1,1,1]).buffer));
});

test.serial("Statement.columns()", async (t) => {
const db = t.context.db;

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libsql",
"version": "0.4.0-pre.8",
"version": "0.4.0-pre.9",
"description": "A better-sqlite3 compatible API for libSQL that supports Bun, Deno, and Node",
"os": [
"darwin",
Expand Down

0 comments on commit e919712

Please sign in to comment.