v0.0.371
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m26s

This commit is contained in:
Mike Schwörer 2024-01-13 14:19:19 +01:00
parent be24f7a190
commit 2afb265ea4
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.370" const GoextVersion = "0.0.371"
const GoextVersionTimestamp = "2024-01-13T14:10:25+0100" const GoextVersionTimestamp = "2024-01-13T14:19:19+0100"

View File

@ -46,7 +46,7 @@ func (db *database) Exec(ctx context.Context, sqlstr string, prep PP) (sql.Resul
for _, v := range db.lstr { for _, v := range db.lstr {
err := v.PreExec(ctx, nil, &sqlstr, &prep) err := v.PreExec(ctx, nil, &sqlstr, &prep)
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "failed to call SQL pre-exec listener").Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
} }
@ -67,7 +67,7 @@ func (db *database) Query(ctx context.Context, sqlstr string, prep PP) (*sqlx.Ro
for _, v := range db.lstr { for _, v := range db.lstr {
err := v.PreQuery(ctx, nil, &sqlstr, &prep) err := v.PreQuery(ctx, nil, &sqlstr, &prep)
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "failed to call SQL pre-query listener").Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"database/sql" "database/sql"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
"gogs.mikescher.com/BlackForestBytes/goext/langext" "gogs.mikescher.com/BlackForestBytes/goext/langext"
) )
@ -48,7 +49,7 @@ func (tx *transaction) Rollback() error {
for _, v := range tx.db.lstr { for _, v := range tx.db.lstr {
err := v.PreTxRollback(tx.id) err := v.PreTxRollback(tx.id)
if err != nil { if err != nil {
return err return exerr.Wrap(err, "failed to call SQL pre-rollback listener").Int("tx.id", int(tx.id)).Build()
} }
} }
@ -69,7 +70,7 @@ func (tx *transaction) Commit() error {
for _, v := range tx.db.lstr { for _, v := range tx.db.lstr {
err := v.PreTxCommit(tx.id) err := v.PreTxCommit(tx.id)
if err != nil { if err != nil {
return err return exerr.Wrap(err, "failed to call SQL pre-commit listener").Int("tx.id", int(tx.id)).Build()
} }
} }
@ -91,7 +92,7 @@ func (tx *transaction) Exec(ctx context.Context, sqlstr string, prep PP) (sql.Re
for _, v := range tx.db.lstr { for _, v := range tx.db.lstr {
err := v.PreExec(ctx, langext.Ptr(tx.id), &sqlstr, &prep) err := v.PreExec(ctx, langext.Ptr(tx.id), &sqlstr, &prep)
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "failed to call SQL pre-exec listener").Int("tx.id", int(tx.id)).Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
} }
@ -106,7 +107,7 @@ func (tx *transaction) Exec(ctx context.Context, sqlstr string, prep PP) (sql.Re
} }
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "Failed to [exec] sql statement").Int("tx.id", int(tx.id)).Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
return res, nil return res, nil
} }
@ -116,7 +117,7 @@ func (tx *transaction) Query(ctx context.Context, sqlstr string, prep PP) (*sqlx
for _, v := range tx.db.lstr { for _, v := range tx.db.lstr {
err := v.PreQuery(ctx, langext.Ptr(tx.id), &sqlstr, &prep) err := v.PreQuery(ctx, langext.Ptr(tx.id), &sqlstr, &prep)
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "failed to call SQL pre-query listener").Int("tx.id", int(tx.id)).Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
} }
@ -131,7 +132,7 @@ func (tx *transaction) Query(ctx context.Context, sqlstr string, prep PP) (*sqlx
} }
if err != nil { if err != nil {
return nil, err return nil, exerr.Wrap(err, "Failed to [query] sql statement").Int("tx.id", int(tx.id)).Str("original_sql", origsql).Str("sql", sqlstr).Any("sql_params", prep).Build()
} }
return rows, nil return rows, nil
} }