be38c83fd8
* db cleanup * dev * pg setup * postgres uuid migration * cleanup * fk * sqlite migration * cleanup * wal * max open conns = 1 * fix panic --------- Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
23 lines
344 B
Go
23 lines
344 B
Go
package sqlite
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
_ "modernc.org/sqlite"
|
|
)
|
|
|
|
func New(filename string) (*Sqlite3Accessor, error) {
|
|
db, err := sql.Open("sqlite", filename+"?_pragma=busy_timeout(30000)")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
err = EnableWAL(db)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
sq := &Sqlite3Accessor{db: db}
|
|
return sq, nil
|
|
}
|