You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/internal/conf/db_nocgo.go

26 lines
469 B

//go:build !cgo
// +build !cgo
package conf
import (
"database/sql"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
_ "modernc.org/sqlite"
)
const (
sqlite3InCgoEnabled = false
)
func OpenSqlite3() (*sql.DB, error) {
return sql.Open("sqlite", Sqlite3Setting.Dsn("sqlite"))
}
func gormOpenSqlite3(opts ...gorm.Option) (*gorm.DB, error) {
dialector := &sqlite.Dialector{DriverName: "sqlite", DSN: Sqlite3Setting.Dsn("sqlite")}
return gorm.Open(dialector, opts...)
}