updated deps; switched sitemap lib; ent regen

This commit is contained in:
2023-03-03 20:10:31 +01:00
parent e9a5daa9e3
commit 727d530378
52 changed files with 2626 additions and 5665 deletions

View File

@@ -308,34 +308,7 @@ func (mu *MatchUpdate) RemovePlayers(p ...*Player) *MatchUpdate {
// Save executes the query and returns the number of nodes affected by the update operation.
func (mu *MatchUpdate) Save(ctx context.Context) (int, error) {
var (
err error
affected int
)
if len(mu.hooks) == 0 {
affected, err = mu.sqlSave(ctx)
} else {
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*MatchMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
mu.mutation = mutation
affected, err = mu.sqlSave(ctx)
mutation.done = true
return affected, err
})
for i := len(mu.hooks) - 1; i >= 0; i-- {
if mu.hooks[i] == nil {
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
}
mut = mu.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, mu.mutation); err != nil {
return 0, err
}
}
return affected, err
return withHooks[int, MatchMutation](ctx, mu.sqlSave, mu.mutation, mu.hooks)
}
// SaveX is like Save, but panics if an error occurs.
@@ -367,16 +340,7 @@ func (mu *MatchUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchUpd
}
func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
_spec := &sqlgraph.UpdateSpec{
Node: &sqlgraph.NodeSpec{
Table: match.Table,
Columns: match.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeUint64,
Column: match.FieldID,
},
},
}
_spec := sqlgraph.NewUpdateSpec(match.Table, match.Columns, sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64))
if ps := mu.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
@@ -573,6 +537,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
return 0, err
}
mu.mutation.done = true
return n, nil
}
@@ -860,6 +825,12 @@ func (muo *MatchUpdateOne) RemovePlayers(p ...*Player) *MatchUpdateOne {
return muo.RemovePlayerIDs(ids...)
}
// Where appends a list predicates to the MatchUpdate builder.
func (muo *MatchUpdateOne) Where(ps ...predicate.Match) *MatchUpdateOne {
muo.mutation.Where(ps...)
return muo
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (muo *MatchUpdateOne) Select(field string, fields ...string) *MatchUpdateOne {
@@ -869,40 +840,7 @@ func (muo *MatchUpdateOne) Select(field string, fields ...string) *MatchUpdateOn
// Save executes the query and returns the updated Match entity.
func (muo *MatchUpdateOne) Save(ctx context.Context) (*Match, error) {
var (
err error
node *Match
)
if len(muo.hooks) == 0 {
node, err = muo.sqlSave(ctx)
} else {
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*MatchMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
muo.mutation = mutation
node, err = muo.sqlSave(ctx)
mutation.done = true
return node, err
})
for i := len(muo.hooks) - 1; i >= 0; i-- {
if muo.hooks[i] == nil {
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
}
mut = muo.hooks[i](mut)
}
v, err := mut.Mutate(ctx, muo.mutation)
if err != nil {
return nil, err
}
nv, ok := v.(*Match)
if !ok {
return nil, fmt.Errorf("unexpected node type %T returned from MatchMutation", v)
}
node = nv
}
return node, err
return withHooks[*Match, MatchMutation](ctx, muo.sqlSave, muo.mutation, muo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
@@ -934,16 +872,7 @@ func (muo *MatchUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *Matc
}
func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error) {
_spec := &sqlgraph.UpdateSpec{
Node: &sqlgraph.NodeSpec{
Table: match.Table,
Columns: match.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeUint64,
Column: match.FieldID,
},
},
}
_spec := sqlgraph.NewUpdateSpec(match.Table, match.Columns, sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64))
id, ok := muo.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Match.id" for update`)}
@@ -1160,5 +1089,6 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
}
return nil, err
}
muo.mutation.done = true
return _node, nil
}