New comment by psanford in "Litestream VFS"
github.com·4d·
Discuss: Hacker News
💾SQLite
Preview
Report Post

sqlite3vfs: Go sqlite3 VFS API

sqlite3vfs is a Cgo API that allows you to create custom sqlite Virtual File Systems (VFS) in Go. You can use this with the sqlite3 https://github.com/mattn/go-sqlite3 SQL driver.

Basic usage

To use, simply implement the VFS and File interfaces. Then register your VFS with sqlite3vfs and include the vfs name when opening the database connection:

// create your VFS
vfs := newTempVFS()

vfsName := "tmpfs"
err := sqlite3vfs.RegisterVFS(vfsName, vfs)
if err != nil {
panic(err)
}

db, err := sql.Open("sqlite3", fmt.Sprintf("foo.db?vfs=%s", vfsName))
if err ...

Similar Posts

Loading similar posts...