89 lines
2.4 KiB
Go
89 lines
2.4 KiB
Go
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
||
|
package ent
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"entgo.io/ent/dialect/sql"
|
||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
"entgo.io/ent/schema/field"
|
||
|
"git.dotya.ml/mirre-mt/pcmt/ent/predicate"
|
||
|
"git.dotya.ml/mirre-mt/pcmt/ent/trackedbreaches"
|
||
|
)
|
||
|
|
||
|
// TrackedBreachesDelete is the builder for deleting a TrackedBreaches entity.
|
||
|
type TrackedBreachesDelete struct {
|
||
|
config
|
||
|
hooks []Hook
|
||
|
mutation *TrackedBreachesMutation
|
||
|
}
|
||
|
|
||
|
// Where appends a list predicates to the TrackedBreachesDelete builder.
|
||
|
func (tbd *TrackedBreachesDelete) Where(ps ...predicate.TrackedBreaches) *TrackedBreachesDelete {
|
||
|
tbd.mutation.Where(ps...)
|
||
|
return tbd
|
||
|
}
|
||
|
|
||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||
|
func (tbd *TrackedBreachesDelete) Exec(ctx context.Context) (int, error) {
|
||
|
return withHooks(ctx, tbd.sqlExec, tbd.mutation, tbd.hooks)
|
||
|
}
|
||
|
|
||
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
func (tbd *TrackedBreachesDelete) ExecX(ctx context.Context) int {
|
||
|
n, err := tbd.Exec(ctx)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return n
|
||
|
}
|
||
|
|
||
|
func (tbd *TrackedBreachesDelete) sqlExec(ctx context.Context) (int, error) {
|
||
|
_spec := sqlgraph.NewDeleteSpec(trackedbreaches.Table, sqlgraph.NewFieldSpec(trackedbreaches.FieldID, field.TypeUUID))
|
||
|
if ps := tbd.mutation.predicates; len(ps) > 0 {
|
||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||
|
for i := range ps {
|
||
|
ps[i](selector)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
affected, err := sqlgraph.DeleteNodes(ctx, tbd.driver, _spec)
|
||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||
|
}
|
||
|
tbd.mutation.done = true
|
||
|
return affected, err
|
||
|
}
|
||
|
|
||
|
// TrackedBreachesDeleteOne is the builder for deleting a single TrackedBreaches entity.
|
||
|
type TrackedBreachesDeleteOne struct {
|
||
|
tbd *TrackedBreachesDelete
|
||
|
}
|
||
|
|
||
|
// Where appends a list predicates to the TrackedBreachesDelete builder.
|
||
|
func (tbdo *TrackedBreachesDeleteOne) Where(ps ...predicate.TrackedBreaches) *TrackedBreachesDeleteOne {
|
||
|
tbdo.tbd.mutation.Where(ps...)
|
||
|
return tbdo
|
||
|
}
|
||
|
|
||
|
// Exec executes the deletion query.
|
||
|
func (tbdo *TrackedBreachesDeleteOne) Exec(ctx context.Context) error {
|
||
|
n, err := tbdo.tbd.Exec(ctx)
|
||
|
switch {
|
||
|
case err != nil:
|
||
|
return err
|
||
|
case n == 0:
|
||
|
return &NotFoundError{trackedbreaches.Label}
|
||
|
default:
|
||
|
return nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
func (tbdo *TrackedBreachesDeleteOne) ExecX(ctx context.Context) {
|
||
|
if err := tbdo.Exec(ctx); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|