updated deps; switched sitemap lib; ent regen
This commit is contained in:
@@ -4,7 +4,6 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -28,34 +27,7 @@ func (pd *PlayerDelete) Where(ps ...predicate.Player) *PlayerDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (pd *PlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(pd.hooks) == 0 {
|
||||
affected, err = pd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*PlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
pd.mutation = mutation
|
||||
affected, err = pd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(pd.hooks) - 1; i >= 0; i-- {
|
||||
if pd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = pd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, pd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks[int, PlayerMutation](ctx, pd.sqlExec, pd.mutation, pd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
@@ -68,15 +40,7 @@ func (pd *PlayerDelete) ExecX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
func (pd *PlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: player.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(player.Table, sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64))
|
||||
if ps := pd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
@@ -88,6 +52,7 @@ func (pd *PlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
pd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
@@ -96,6 +61,12 @@ type PlayerDeleteOne struct {
|
||||
pd *PlayerDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the PlayerDelete builder.
|
||||
func (pdo *PlayerDeleteOne) Where(ps ...predicate.Player) *PlayerDeleteOne {
|
||||
pdo.pd.mutation.Where(ps...)
|
||||
return pdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (pdo *PlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := pdo.pd.Exec(ctx)
|
||||
@@ -111,5 +82,7 @@ func (pdo *PlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (pdo *PlayerDeleteOne) ExecX(ctx context.Context) {
|
||||
pdo.pd.ExecX(ctx)
|
||||
if err := pdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user