updated dep. and regen ent

This commit is contained in:
2021-10-24 05:49:21 +02:00
parent 3a9652b1fc
commit 6b73f7b9b4
12 changed files with 139 additions and 108 deletions

View File

@@ -8,9 +8,7 @@ import (
"ALHP.go/ent/dbpackage"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ent aliases to avoid import conflicts in user's code.
@@ -159,7 +157,7 @@ func (e *ValidationError) Unwrap() error {
return e.err
}
// IsValidationError returns a boolean indicating whether the error is a validaton error.
// IsValidationError returns a boolean indicating whether the error is a validation error.
func IsValidationError(err error) bool {
if err == nil {
return false
@@ -259,21 +257,3 @@ func IsConstraintError(err error) bool {
var e *ConstraintError
return errors.As(err, &e)
}
func isSQLConstraintError(err error) (*ConstraintError, bool) {
if sqlgraph.IsConstraintError(err) {
return &ConstraintError{err.Error(), err}, true
}
return nil, false
}
// rollback calls tx.Rollback and wraps the given error with the rollback error if present.
func rollback(tx dialect.Tx, err error) error {
if rerr := tx.Rollback(); rerr != nil {
err = fmt.Errorf("%w: %v", err, rerr)
}
if err, ok := isSQLConstraintError(err); ok {
return err
}
return err
}