From 5163f8ea401954795b1c2863f1cccec9d2ff047b Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Tue, 6 Aug 2024 00:00:19 +0100 Subject: [PATCH] Update go docs (#56) I'm guessing this version (from the CGO example) is more widely applicable (I ship a `database/sql` driver as well). PS: if you find that all the copies and allocs are a bottleneck, I'm guessing an `buf, err := sqlite_vec .AppendFloat32(buf, values)`, or even an API change (on my side) that allows serializing directly into "native" memory, would help. --- site/using/go.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/site/using/go.md b/site/using/go.md index 84d794f..aced7f2 100644 --- a/site/using/go.md +++ b/site/using/go.md @@ -107,7 +107,10 @@ If vectors are provided as a list of floats, use `SerializeFloat32(list)` to ser values := []float32{0.1, 0.1, 0.1, 0.1} v, err := sqlite_vec.SerializeFloat32(values) if err != nil { - log.Fatal(err) + log.Fatal(err) +} +_, err = db.Exec("INSERT INTO vec_items(rowid, embedding) VALUES (?, ?)", id, v) +if err != nil { + log.Fatal(err) } -stmt.BindInt(1, id) ```