mattn / go-sqlite3

sqlite3 driver for go using database/sql
http://mattn.github.io/go-sqlite3
MIT License
7.64k stars 1.08k forks source link

feature request: sqlar #1252

Open ndajr opened 6 days ago

ndajr commented 6 days ago

sqlite has a feature called sqlar which allows one to use the database as a file store: https://www.sqlite.org/sqlar.html.

It means we need zlib and two SQL functions (sqlar_compress/sqlar_uncompress). I read the features section on the README but it's not clear how I would enable sqlar. How hard would it be to add this feature to go-sqlite3? With some guidance I am happy to do my first contribution. Many thanks!

rittneje commented 4 days ago

I believe that the SQLite CLI (which is also named sqlite3) simply includes the sqlar extension by default. It is not really a feature of the SQLite core library, which is what this Go module wraps.

If you wish to include the sqlar extension in your application, you should be able to follow the process documented here: https://pkg.go.dev/github.com/mattn/go-sqlite3#hdr-SQLite3_Extension

ndajr commented 4 days ago

Is there a community repo for SQLite extensions? Sure I could throw some C code in my Go application, but is there a better way? If this is the only option, I am probably going to reinvent my own "sqlar" creating a table with the same schema and compressing/decompressing files myself with Go