func (s *SqliteBackend) Open() error {
	db, err := sqlx.Open("sqlite3", s.Path)
	if err != nil {
		return err
	}
	if _, err := db.Exec("PRAGMA synchronous = OFF;"); err != nil {
		return err
	}
	if _, err := db.Exec("PRAGMA journal_mode = MEMORY;"); err != nil {
		return err
	}
	s.db = db
	return nil
}
Open initializes a new sqlite sqlx database connection
package data
import (
	"database/sql"
	"log"
	"os"
	"path"
	"github.com/mdlayher/wavepipe/common"
	"github.com/jmoiron/sqlx"
	_ "github.com/mattn/go-sqlite3"
)
type SqliteBackend struct {
	Path string
	db   *sqlx.DB
}
func (s *SqliteBackend) DSN(path string) {
	s.Path = common.ExpandHomeDir(path)
}
func (s *SqliteBackend) Setup() error {
	_, err := os.Stat(s.Path)
	if err == nil {
		return nil
	}
	if !os.IsNotExist(err) {
		return err
	}
	log.Println("db: creating new database file:", s.Path)
	dir := path.Dir(s.Path) + "/"
	file := path.Base(s.Path)
	if err := os.MkdirAll(dir, 0775); err != nil {
		return err
	}
	dbBuf, err := Asset("res/sqlite/wavepipe.db")
	if err != nil {
		return err
	}
	dest, err := os.Create(dir + file)
	if err != nil {
		return err
	}
	if _, err := dest.Write(dbBuf); err != nil {
		return err
	}
	if err := dest.Close(); err != nil {
		return err
	}
	return nil
}