Batch Query callback is called even when there is an error
This allows the callback to handle additional error types such as foreign key constraint violations. See https://github.com/jackc/pgx/pull/1538.
This commit is contained in:
@@ -21,13 +21,10 @@ type batchItemFunc func(br BatchResults) error
|
||||
// Query sets fn to be called when the response to qq is received.
|
||||
func (qq *QueuedQuery) Query(fn func(rows Rows) error) {
|
||||
qq.fn = func(br BatchResults) error {
|
||||
rows, err := br.Query()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rows, _ := br.Query()
|
||||
defer rows.Close()
|
||||
|
||||
err = fn(rows)
|
||||
err := fn(rows)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user