mattn / mattn/go-sqlite3

Add driver.Connector implementation

Open
#1,001 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
9.2k
Forks
1.2k
Avg merge
19m
Merged PRs (30d)
4

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the database/sql/driver.Connector interface and the existing SQLiteDriver.Open entry point. Implement the SQLiteConnector shape described in the issue, then verify that connections can be configured and opened without registering conflicting driver names; update the unit tests that currently depend on registration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sqlite
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.