-
Notifications
You must be signed in to change notification settings - Fork 1.5k
pgx: don't use database/sql interface #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
it'd be nice to have contexts for many of these methods, but that'd be a much wider change
See also #1132. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLocked atomic.Bool | ||
|
||
// Open and WithInstance need to guarantee that config is never nil | ||
config *Config | ||
} | ||
|
||
func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) { | ||
func WithInstance(instance *pgx.Conn, config *Config) (database.Driver, error) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
it'd be nice to have contexts for many of these methods, but that'd be a much wider change