-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
PostgreSQL Batch Example in Go #201
Conversation
examples/batch/batch.go
Outdated
fmt.Println(query.SQL) | ||
|
||
// BatchResult.Query reads results from a queued query | ||
// BatchResult.Query reads results from the current query | ||
rows, err := br.Query() |
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.
The first query is INSERT
. It returns no rows. It's wrong to use br.Query
for it
2957dd3
to
b0d1e2a
Compare
You may finish your work now. Please, make sure folder structure looks the same as for other examples, e.g. no |
Thanks @pashagolub I would like to reopen this PR to further improve this example. |
OK, the pull-request branch was deleted. We need to proceed in the new PR |
Description:
This Go program demonstrates interacting with a PostgreSQL database using batch operations for improved efficiency. It leverages the
pgx/v5
library for database connectivity.Features:
ledger
to store data (description and amount).pgx.Batch
. This includes inserts (INSERT
), selects (SELECT
), and an aggregate function (SUM
).Begin
,Commit
, andRollback
.ledger
table after processing.