mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-26 01:06:27 +02:00
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:
parent
bd5c847a97
commit
5163f8ea40
1 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue