1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-12-01 02:56:49 +02:00
pocketbase/core/db_cgo.go

23 lines
326 B
Go
Raw Normal View History

2022-07-06 23:19:05 +02:00
//go:build cgo
package core
import (
2022-12-11 17:32:56 +02:00
"github.com/pocketbase/dbx"
_ "github.com/mattn/go-sqlite3"
2022-07-06 23:19:05 +02:00
)
func connectDB(dbPath string) (*dbx.DB, error) {
db, err := dbx.Open("sqlite3", dbPath)
if err != nil {
return nil, err
2022-07-06 23:19:05 +02:00
}
if err := initPragmas(db); err != nil {
db.Close()
return nil, err
}
2022-07-06 23:19:05 +02:00
return db, nil
2022-07-06 23:19:05 +02:00
}