1
0
forked from MTSR/mapserver
mapserver/mapobjectdb/sqlite/new.go
Buckaroo Banzai ddb5267a3b
Go releaser (#238)
* add goreleaser config

* update go.mod / gitignore

* dev/cross cleanup

* switch to cgo-less sqlite driver

* workflows

* fix build workflow

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
2022-02-01 14:59:29 +01:00

20 lines
313 B
Go

package sqlite
import (
"database/sql"
_ "modernc.org/sqlite"
)
func New(filename string) (*Sqlite3Accessor, error) {
db, err := sql.Open("sqlite", filename+"?_timeout=500")
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}
sq := &Sqlite3Accessor{db: db, filename: filename}
return sq, nil
}