initial commit
This commit is contained in:
115
ent/supportresponse_delete.go
Normal file
115
ent/supportresponse_delete.go
Normal file
@@ -0,0 +1,115 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/FrankenBotDev/FrankenAPI/ent/predicate"
|
||||
"github.com/FrankenBotDev/FrankenAPI/ent/supportresponse"
|
||||
)
|
||||
|
||||
// SupportResponseDelete is the builder for deleting a SupportResponse entity.
|
||||
type SupportResponseDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *SupportResponseMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SupportResponseDelete builder.
|
||||
func (srd *SupportResponseDelete) Where(ps ...predicate.SupportResponse) *SupportResponseDelete {
|
||||
srd.mutation.Where(ps...)
|
||||
return srd
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (srd *SupportResponseDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(srd.hooks) == 0 {
|
||||
affected, err = srd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SupportResponseMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
srd.mutation = mutation
|
||||
affected, err = srd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(srd.hooks) - 1; i >= 0; i-- {
|
||||
if srd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = srd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, srd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (srd *SupportResponseDelete) ExecX(ctx context.Context) int {
|
||||
n, err := srd.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (srd *SupportResponseDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: supportresponse.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: supportresponse.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := srd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, srd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// SupportResponseDeleteOne is the builder for deleting a single SupportResponse entity.
|
||||
type SupportResponseDeleteOne struct {
|
||||
srd *SupportResponseDelete
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (srdo *SupportResponseDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := srdo.srd.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{supportresponse.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (srdo *SupportResponseDeleteOne) ExecX(ctx context.Context) {
|
||||
srdo.srd.ExecX(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user