Skip to content

Please modify driver's registration logic. #71

Closed
@awly

Description

@awly

Please modify driver's registration logic.
If I want to work with database/sql package only (which in my opinion is the "better" way) currently I have to add
import _ "github.com/bmizerany/pq"
to trigger pq's init() to call the driver registration on line 33.

I believe that _ imports are in general "bad" as a design decision, and using standard go's lib's sql package is the preferred way to work with sql databases.

At the very least, please put a note in the readme to avoid confusion caused by the lack of (exported) Driver.

Proposed solutions:

  • export the driver, remove sql.Register from init()
  • add explicit func Register(), remove sql.Register from init()
  • leave as is, but document somewhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions