diff --git a/sqlite.go b/sqlite.go index b84147e..0b109c0 100644 --- a/sqlite.go +++ b/sqlite.go @@ -26,6 +26,13 @@ type Dialector struct { Conn gorm.ConnPool } +type Config struct { + DriverName string + DSN string + Conn gorm.ConnPool +} + + func Open(dsn string) gorm.Dialector { return &Dialector{DSN: dsn} } @@ -73,6 +80,10 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) { return } +func New(config Config) gorm.Dialector { + return &Dialector{DSN: config.DSN, DriverName: config.DriverName, Conn: config.Conn} +} + func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder { return map[string]clause.ClauseBuilder{ "INSERT": func(c clause.Clause, builder clause.Builder) {