mirror of
https://github.com/pocketbase/pocketbase.git
synced 2024-11-28 10:03:42 +02:00
23 lines
326 B
Go
23 lines
326 B
Go
//go:build cgo
|
|
|
|
package core
|
|
|
|
import (
|
|
"github.com/pocketbase/dbx"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
func connectDB(dbPath string) (*dbx.DB, error) {
|
|
db, err := dbx.Open("sqlite3", dbPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := initPragmas(db); err != nil {
|
|
db.Close()
|
|
return nil, err
|
|
}
|
|
|
|
return db, nil
|
|
}
|