// 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" "github.com/hay-kot/homebox/backend/internal/data/ent/actiontoken" "github.com/hay-kot/homebox/backend/internal/data/ent/predicate" ) // ActionTokenDelete is the builder for deleting a ActionToken entity. type ActionTokenDelete struct { config hooks []Hook mutation *ActionTokenMutation } // Where appends a list predicates to the ActionTokenDelete builder. func (atd *ActionTokenDelete) Where(ps ...predicate.ActionToken) *ActionTokenDelete { atd.mutation.Where(ps...) return atd } // Exec executes the deletion query and returns how many vertices were deleted. func (atd *ActionTokenDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, atd.sqlExec, atd.mutation, atd.hooks) } // ExecX is like Exec, but panics if an error occurs. func (atd *ActionTokenDelete) ExecX(ctx context.Context) int { n, err := atd.Exec(ctx) if err != nil { panic(err) } return n } func (atd *ActionTokenDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(actiontoken.Table, sqlgraph.NewFieldSpec(actiontoken.FieldID, field.TypeUUID)) if ps := atd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, atd.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } atd.mutation.done = true return affected, err } // ActionTokenDeleteOne is the builder for deleting a single ActionToken entity. type ActionTokenDeleteOne struct { atd *ActionTokenDelete } // Where appends a list predicates to the ActionTokenDelete builder. func (atdo *ActionTokenDeleteOne) Where(ps ...predicate.ActionToken) *ActionTokenDeleteOne { atdo.atd.mutation.Where(ps...) return atdo } // Exec executes the deletion query. func (atdo *ActionTokenDeleteOne) Exec(ctx context.Context) error { n, err := atdo.atd.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{actiontoken.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (atdo *ActionTokenDeleteOne) ExecX(ctx context.Context) { if err := atdo.Exec(ctx); err != nil { panic(err) } }