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

@ -109,5 +109,8 @@ v, err := sqlite_vec.SerializeFloat32(values)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
stmt.BindInt(1, id) _, err = db.Exec("INSERT INTO vec_items(rowid, embedding) VALUES (?, ?)", id, v)
if err != nil {
log.Fatal(err)
}
``` ```