Replies: 1 comment 1 reply
-
Yes.
It's fine. Only thing is you have to make sure the Rows returned from Query is closed either by Next() until false or by calling Close() explicitly. All that said, while functionally you can use Query() for queries that do not return a result set, it's more idiomatic to use Exec(). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For the
database/sql
package,Query
is often used for read operations andExec
is used for operations that don't return a data. Does this hold forpgxpool.Exec
vspgxpool.Query
?It seems like
pgxpool.Query
works for most of the operations (SELECT / UPDATE / CREATE / DROP etc.). Is there a risk for usingpgxpool.Query
for all operations?Beta Was this translation helpful? Give feedback.
All reactions