mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +00:00
56df515e5f
* chore: use pgx v5 * chore: update go version * remove direct pq dependency * remove unnecessary type * scan test * map scanner * converter * uint8 number array * duration * most unit tests work * unit tests work * chore: coverage * go 1.21 * linting * int64 gopfertammi * retry go 1.22 * retry go 1.22 * revert to go v1.21.5 * update go toolchain to 1.21.8 * go 1.21.8 * remove test flag * go 1.21.5 * linting * update toolchain * use correct array * use correct array * add byte array * correct value * correct error message * go 1.21 compatible
23 lines
441 B
Go
23 lines
441 B
Go
package initialise
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/jackc/pgx/v5/pgconn"
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
)
|
|
|
|
func exec(db *database.DB, stmt string, possibleErrCodes []string, args ...interface{}) error {
|
|
_, err := db.Exec(stmt, args...)
|
|
pgErr := new(pgconn.PgError)
|
|
if errors.As(err, &pgErr) {
|
|
for _, possibleCode := range possibleErrCodes {
|
|
if possibleCode == pgErr.Code {
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
return err
|
|
}
|