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.
This commit is contained in:
Nuno Cruces 2024-08-06 00:00:19 +01:00 committed by GitHub
parent bd5c847a97
commit 5163f8ea40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
```