Skip to content

NewConn vs NewPool #83

Answered by pashagolub
nikitacrit asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

depends on your application code. If you are using pgxpool package then you probably want func NewPool(options ...func(*pgxmock) error) (PgxPoolIface, error).

If you are using pgx then you should use func NewConn(options ...func(*pgxmock) error) (PgxConnIface, error).

*pgx.Conn represents a single connection to the database and is not concurrency safe. Use sub-package pgxpool for a concurrency-safe connection pool.

Regards

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nikitacrit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants