Using sqlx and pgx in a project #1530
-
|
Hi, I am looking to use both sqlx and pgx in a project. This would allow users to choose between connection types based on their application needs (requiring postgres-specific functionality or not). I was wondering if you could give more clarify on the second point and if there could be potential complications from offering both a sqlx and pgx connection. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
sqlx requires But it would probably be simpler to use |
Beta Was this translation helpful? Give feedback.
sqlx requires
database/sqlso you will have to use thepgx/v5/stdlibpackage. There's nothing preventing you from establishing native pgx pools or connections at the same time asdatabase/sql.But it would probably be simpler to use
database/sqland acquire a pgx connection from it when you need PostgreSQL functionality such asCOPY FROM. See the package docs for stdlib for an example.