Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/asg017/sqlite-vec-ncruces-bindings
Go bindings for sqlite-vec
project. In a separate repo to keep the original repo from getting too large.
There are two options when adding sqlite-vec
to a Go project — A traditional CGO option, and a WASM-based option for the ncruces/go-sqlite3 project.
Both are available in this Go module, which can be installed with:
go get -u github.com/asg017/sqlite-vec-go-bindings
For most SQLite Go libraries that use CGO, like mattn/go-sqlite3
, use the CGO portion of this Go module. It will compile the sqlite-vec
libary from source and embed into your application.
package main
import (
"database/sql"
"log"
sqlite_vec "github.com/asg017/sqlite-vec-go-bindings/cgo"
_ "github.com/mattn/go-sqlite3"
)
import "C"
func main() {
sqlite_vec.Auto()
db, err := sql.Open("sqlite3", ":memory:")
if err != nil {
log.Fatal(err)
}
defer db.Close()
var sqliteVersion string
var vecVersion string
err = db.QueryRow("select sqlite_version(), vec_version()").Scan(&sqliteVersion, &vecVersion)
if err != nil {
log.Fatal(err)
}
log.Printf("sqlite_version=%s, vec_version=%s\n", sqliteVersion, vecVersion)
}
Use sqlite_vec.Auto()
before opening a connection to automatically register sqlite-vec
functions. See simple-go-cgo/demo.go
for a larger example.
While this works with CGO SQLite/Go libraries like mattn/go-sqlite3
, this will NOT work with other non-CGO library like modernc.org/sqlite
or ncruces/go-sqlite3.
ncruces
WASM BindingsIf you are using the ncruces/go-sqlite3 library, then use the ncruces
portion of this Go module.
package main
import (
_ "embed"
"log"
_ "github.com/asg017/sqlite-vec-go-bindings/ncruces"
"github.com/ncruces/go-sqlite3"
)
func main() {
db, err := sqlite3.Open(":memory:")
if err != nil {
log.Fatal(err)
}
stmt, _, err := db.Prepare(`SELECT sqlite_version(), vec_version()`)
if err != nil {
log.Fatal(err)
}
stmt.Step()
log.Printf("sqlite_version=%s, vec_version=%s\n", stmt.ColumnText(0), stmt.ColumnText(1))
}
"github.com/asg017/sqlite-vec-go-bindings/ncruces"
will automatically register a new SQLite WASM build that includes sqlite-vec
functions by default. This replaces the "github.com/ncruces/go-sqlite3/embed"
module in that project, so do NOT include them both.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.