From bbca3b3e6f59792cb9ec48442396b72cc08dd144 Mon Sep 17 00:00:00 2001 From: Chris Hurst <46472228+ytsruh@users.noreply.github.com> Date: Wed, 12 Jun 2024 05:02:20 +0100 Subject: [PATCH] Added Config for custom driver (specifically libSQL) (#185) * added config for custom driver * fix error handling and tests failing --- sqlite.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sqlite.go b/sqlite.go index dc76d110..0543d0b1 100644 --- a/sqlite.go +++ b/sqlite.go @@ -24,10 +24,20 @@ 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} } +func New(config Config) gorm.Dialector { + return &Dialector{DSN: config.DSN, DriverName: config.DriverName, Conn: config.Conn} +} + func (dialector Dialector) Name() string { return "sqlite" }