Add dialects

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
m.nabokikh
2021-09-13 17:48:02 +04:00
parent eae3219e4d
commit fb38e1235d
64 changed files with 1198 additions and 596 deletions

View File

@@ -20,9 +20,9 @@ type PasswordUpdate struct {
mutation *PasswordMutation
}
// Where adds a new predicate for the PasswordUpdate builder.
// Where appends a list predicates to the PasswordUpdate builder.
func (pu *PasswordUpdate) Where(ps ...predicate.Password) *PasswordUpdate {
pu.mutation.predicates = append(pu.mutation.predicates, ps...)
pu.mutation.Where(ps...)
return pu
}
@@ -81,6 +81,9 @@ func (pu *PasswordUpdate) Save(ctx context.Context) (int, error) {
return affected, err
})
for i := len(pu.hooks) - 1; i >= 0; i-- {
if pu.hooks[i] == nil {
return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
}
mut = pu.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, pu.mutation); err != nil {
@@ -181,8 +184,8 @@ func (pu *PasswordUpdate) sqlSave(ctx context.Context) (n int, err error) {
if n, err = sqlgraph.UpdateNodes(ctx, pu.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{password.Label}
} else if cerr, ok := isSQLConstraintError(err); ok {
err = cerr
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
}
return 0, err
}
@@ -259,6 +262,9 @@ func (puo *PasswordUpdateOne) Save(ctx context.Context) (*Password, error) {
return node, err
})
for i := len(puo.hooks) - 1; i >= 0; i-- {
if puo.hooks[i] == nil {
return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
}
mut = puo.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, puo.mutation); err != nil {
@@ -379,8 +385,8 @@ func (puo *PasswordUpdateOne) sqlSave(ctx context.Context) (_node *Password, err
if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{password.Label}
} else if cerr, ok := isSQLConstraintError(err); ok {
err = cerr
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
}
return nil, err
}