asg017 / sqlite-vss

A SQLite extension for efficient vector search, based on Faiss!
MIT License
1.59k stars 59 forks source link

Add Go support. #16

Open sno6 opened 1 year ago

sno6 commented 1 year ago

Hey, I've been playing around with sqlite-vss in Go quite a bit recently so thought I'd chuck up an MR.

It doesn't package up the extensions like the ts/py packages, it's just a lightweight wrapper around a Go driver to make things a little easier for Go folks to get up and running.

asg017 commented 1 year ago

Hey @sno6 , thanks for the contribution!

I think it's a great idea to add a "how to use sqlite-vss in a Go" example to the README, but not sure about adding a Go module yet. I think like the Python/Node/Deno bindings, I'd like a Go binding solution to solve the "where does the loadable file exist" problem. In this module, a user will still need to download + find the correct sqlite-vss loadable extension for their platform, which isn't very easy.

Instead, I think it should be possible to statically link sqlite-vss as a Go module. That way, if someone imports github.com/asg017/sqlite-vss/go, then sqlite-vss will be compiled and statically linked inside the Go binary.

Unfortunately it won't be easy: this issue seems to suggest it's possible, but sqlite-vss is quite difficult to compile. We can possibly release .o files for different platforms to make this a bit easier, but it'll be a challenge nonetheless.

If you're able to change this PR to just include an example Go code snipper in the README, that'll be great! Otherwise I'll probably add one myself in a few weeks.

Again, thanks for the contribution!