A small wrapper for [zombiezen/go-sqlite].
It just simplifies establishing a connection pool to a database and initializing flags and pragmas.
Most of the time, the following is sufficient to get going:
package main
import "git.sr.ht/~mikattack/go-sqlite/database"
func main() {
// Default configuration, passed here for completeness.
// May be omitted if you don't need other options.
opts := Configuration{
Flags: 0,
MaxConnections: 10,
Pragmas: map[string]string = map[string]string{
"busy_timeout": "5000",
"foreign_keys": "on",
"journal_mode": "wal",
},
}
// Establish a *sqlitex.Pool with opts applied.
pool, err := database.NewConnectionPool("file:/path/to/sqlite.db", opts)
if err != nil {
return nil, err
}
// Rest of application
...
}