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 ConnectorUpdate struct {
mutation *ConnectorMutation
}
// Where adds a new predicate for the ConnectorUpdate builder.
// Where appends a list predicates to the ConnectorUpdate builder.
func (cu *ConnectorUpdate) Where(ps ...predicate.Connector) *ConnectorUpdate {
cu.mutation.predicates = append(cu.mutation.predicates, ps...)
cu.mutation.Where(ps...)
return cu
}
@@ -81,6 +81,9 @@ func (cu *ConnectorUpdate) Save(ctx context.Context) (int, error) {
return affected, err
})
for i := len(cu.hooks) - 1; i >= 0; i-- {
if cu.hooks[i] == nil {
return 0, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
}
mut = cu.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, cu.mutation); err != nil {
@@ -176,8 +179,8 @@ func (cu *ConnectorUpdate) sqlSave(ctx context.Context) (n int, err error) {
if n, err = sqlgraph.UpdateNodes(ctx, cu.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{connector.Label}
} else if cerr, ok := isSQLConstraintError(err); ok {
err = cerr
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
}
return 0, err
}
@@ -254,6 +257,9 @@ func (cuo *ConnectorUpdateOne) Save(ctx context.Context) (*Connector, error) {
return node, err
})
for i := len(cuo.hooks) - 1; i >= 0; i-- {
if cuo.hooks[i] == nil {
return nil, fmt.Errorf("db: uninitialized hook (forgotten import db/runtime?)")
}
mut = cuo.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, cuo.mutation); err != nil {
@@ -369,8 +375,8 @@ func (cuo *ConnectorUpdateOne) sqlSave(ctx context.Context) (_node *Connector, e
if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{connector.Label}
} else if cerr, ok := isSQLConstraintError(err); ok {
err = cerr
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
}
return nil, err
}