Skip to content

Commit bbca3b3

Browse files
authored
Added Config for custom driver (specifically libSQL) (#185)
* added config for custom driver * fix error handling and tests failing
1 parent 7544227 commit bbca3b3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sqlite.go

+10
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,20 @@ type Dialector struct {
2424
Conn gorm.ConnPool
2525
}
2626

27+
type Config struct {
28+
DriverName string
29+
DSN string
30+
Conn gorm.ConnPool
31+
}
32+
2733
func Open(dsn string) gorm.Dialector {
2834
return &Dialector{DSN: dsn}
2935
}
3036

37+
func New(config Config) gorm.Dialector {
38+
return &Dialector{DSN: config.DSN, DriverName: config.DriverName, Conn: config.Conn}
39+
}
40+
3141
func (dialector Dialector) Name() string {
3242
return "sqlite"
3343
}

0 commit comments

Comments
 (0)