forked from go-gorm/sqlite
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
I'm trying to figure out how to add custom functions. When I register the custom functions directly to the modernc lib, then I get the following error because both the glebarez lib and the modernc call sql.Register
using the same driver name.
Register called twice for driver sqlite
import (
"database/sql/driver"
"fmt"
"github.com/glebarez/sqlite"
"github.com/tidwall/gjson"
"gorm.io/gorm"
"gorm.io/gorm/logger"
sqlitecore "modernc.org/sqlite"
)
func init() {
sqlitecore.RegisterFunction("FOOBAR", &sqlitecore.FunctionImpl{
NArgs: 2,
Deterministic: true,
Scalar: ...,
})
}
func open(dsn string) (*gorm.DB, error) {
return gorm.Open(sqlite.Open(dsn), &gorm.Config{
Logger: logger.Discard,
})
}
WinXaito
Metadata
Metadata
Assignees
Labels
No labels