Audit with AI
This commit is contained in:
@@ -5,6 +5,7 @@ package pgm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -56,6 +57,9 @@ func (q *updateQry) Where(cond ...Conditioner) WhereOrExec {
|
||||
}
|
||||
|
||||
func (q *updateQry) Exec(ctx context.Context) error {
|
||||
if len(q.cols) == 0 {
|
||||
return errors.New("update query has no columns to update: call Set() before Exec()")
|
||||
}
|
||||
_, err := poolPGX.Load().Exec(ctx, q.String(), q.args...)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -65,6 +69,9 @@ func (q *updateQry) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (q *updateQry) ExecTx(ctx context.Context, tx pgx.Tx) error {
|
||||
if len(q.cols) == 0 {
|
||||
return errors.New("update query has no columns to update: call Set() before ExecTx()")
|
||||
}
|
||||
_, err := tx.Exec(ctx, q.String(), q.args...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user