Skip to content

Add driver.Connector implementation #1001

Open
@rittneje

Description

@rittneje

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions