Skip to content

Commit

Permalink
Added Config for custom driver (specifically libSQL) (#185)
Browse files Browse the repository at this point in the history
* added config for custom driver

* fix error handling and tests failing
  • Loading branch information
ytsruh committed Jun 12, 2024
1 parent 7544227 commit bbca3b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit bbca3b3

Please sign in to comment.