go-sqlite3
go-sqlite3 copied to clipboard
Add driver.Connector implementation
Go 1.10 introduced the driver.Connector interface. This allows configuring custom options for the driver without also having to register it, and also has some other potential advantages over the original approach.
It was originally mentioned in #450 that this would be added in v2, but that seems to have been scrapped.
This change will also simplify a lot of the unit tests, as they won't have to try to avoid conflicting with each other's registered driver names.
For now it can probably be as simple as:
type SQLiteConnector struct {
FileURI string
Driver *SQLiteDriver
}
func (c *SQLiteConnector) Connect(context.Context) (driver.Conn, error) {
return c.Driver.Open(c.FileURI)
}