fixes 45 - cant generate
This commit is contained in:
parent
ed327dc066
commit
ff82ba532a
29 changed files with 1605 additions and 2481 deletions
|
|
@ -1,10 +1,9 @@
|
|||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
|
@ -28,34 +27,7 @@ func (ptd *PasswordTokenDelete) Where(ps ...predicate.PasswordToken) *PasswordTo
|
|||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (ptd *PasswordTokenDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(ptd.hooks) == 0 {
|
||||
affected, err = ptd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*PasswordTokenMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
ptd.mutation = mutation
|
||||
affected, err = ptd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(ptd.hooks) - 1; i >= 0; i-- {
|
||||
if ptd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ptd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, ptd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks(ctx, ptd.sqlExec, ptd.mutation, ptd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
|
@ -68,15 +40,7 @@ func (ptd *PasswordTokenDelete) ExecX(ctx context.Context) int {
|
|||
}
|
||||
|
||||
func (ptd *PasswordTokenDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: passwordtoken.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: passwordtoken.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
_spec := sqlgraph.NewDeleteSpec(passwordtoken.Table, sqlgraph.NewFieldSpec(passwordtoken.FieldID, field.TypeInt))
|
||||
if ps := ptd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
|
|
@ -84,7 +48,12 @@ func (ptd *PasswordTokenDelete) sqlExec(ctx context.Context) (int, error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, ptd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, ptd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
ptd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// PasswordTokenDeleteOne is the builder for deleting a single PasswordToken entity.
|
||||
|
|
@ -92,6 +61,12 @@ type PasswordTokenDeleteOne struct {
|
|||
ptd *PasswordTokenDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the PasswordTokenDelete builder.
|
||||
func (ptdo *PasswordTokenDeleteOne) Where(ps ...predicate.PasswordToken) *PasswordTokenDeleteOne {
|
||||
ptdo.ptd.mutation.Where(ps...)
|
||||
return ptdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ptdo *PasswordTokenDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ptdo.ptd.Exec(ctx)
|
||||
|
|
@ -107,5 +82,7 @@ func (ptdo *PasswordTokenDeleteOne) Exec(ctx context.Context) error {
|
|||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ptdo *PasswordTokenDeleteOne) ExecX(ctx context.Context) {
|
||||
ptdo.ptd.ExecX(ctx)
|
||||
if err := ptdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue