Skip to content

Conversation

@serprex
Copy link

@serprex serprex commented Nov 29, 2024

it'd be nice to have contexts for many of these methods, but that'd be a much wider change

it'd be nice to have contexts for many of these methods, but that'd be a much wider change
@joschi
Copy link
Contributor

joschi commented Dec 9, 2024

it'd be nice to have contexts for many of these methods

See also #1132.

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) {
func WithInstance(instance *pgx.Conn, config *Config) (database.Driver, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. Can you convert the sql.DB to a pgx.Conn internally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to expose a new method for people who want to pass *pgx.Conn directly

You can get *pgx.Conn from *sql.DB potentially with conn, ok := db.Conn().(*pgx.Conn)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into, db.Conn() is itself a wrapper around the driver provided connection. & does not expose handing off underlying connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants