updated deps; switched sitemap lib; ent regen
This commit is contained in:
@@ -80,34 +80,7 @@ func (su *SprayUpdate) ClearMatchPlayers() *SprayUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (su *SprayUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(su.hooks) == 0 {
|
||||
affected, err = su.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
su.mutation = mutation
|
||||
affected, err = su.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(su.hooks) - 1; i >= 0; i-- {
|
||||
if su.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = su.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, su.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks[int, SprayMutation](ctx, su.sqlSave, su.mutation, su.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -139,16 +112,7 @@ func (su *SprayUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SprayUpd
|
||||
}
|
||||
|
||||
func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: spray.Table,
|
||||
Columns: spray.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(spray.Table, spray.Columns, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
if ps := su.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@@ -209,6 +173,7 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
su.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
@@ -270,6 +235,12 @@ func (suo *SprayUpdateOne) ClearMatchPlayers() *SprayUpdateOne {
|
||||
return suo
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SprayUpdate builder.
|
||||
func (suo *SprayUpdateOne) Where(ps ...predicate.Spray) *SprayUpdateOne {
|
||||
suo.mutation.Where(ps...)
|
||||
return suo
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (suo *SprayUpdateOne) Select(field string, fields ...string) *SprayUpdateOne {
|
||||
@@ -279,40 +250,7 @@ func (suo *SprayUpdateOne) Select(field string, fields ...string) *SprayUpdateOn
|
||||
|
||||
// Save executes the query and returns the updated Spray entity.
|
||||
func (suo *SprayUpdateOne) Save(ctx context.Context) (*Spray, error) {
|
||||
var (
|
||||
err error
|
||||
node *Spray
|
||||
)
|
||||
if len(suo.hooks) == 0 {
|
||||
node, err = suo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
suo.mutation = mutation
|
||||
node, err = suo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(suo.hooks) - 1; i >= 0; i-- {
|
||||
if suo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = suo.hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, suo.mutation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nv, ok := v.(*Spray)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected node type %T returned from SprayMutation", v)
|
||||
}
|
||||
node = nv
|
||||
}
|
||||
return node, err
|
||||
return withHooks[*Spray, SprayMutation](ctx, suo.sqlSave, suo.mutation, suo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -344,16 +282,7 @@ func (suo *SprayUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *Spra
|
||||
}
|
||||
|
||||
func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: spray.Table,
|
||||
Columns: spray.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(spray.Table, spray.Columns, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
id, ok := suo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Spray.id" for update`)}
|
||||
@@ -434,5 +363,6 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
suo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user