// Code generated by ent, DO NOT EDIT. package ent import ( "context" "unR2/internal/ent/cloudflareaccounts" "unR2/internal/ent/predicate" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" ) // CloudflareAccountsDelete is the builder for deleting a CloudflareAccounts entity. type CloudflareAccountsDelete struct { config hooks []Hook mutation *CloudflareAccountsMutation } // Where appends a list predicates to the CloudflareAccountsDelete builder. func (cad *CloudflareAccountsDelete) Where(ps ...predicate.CloudflareAccounts) *CloudflareAccountsDelete { cad.mutation.Where(ps...) return cad } // Exec executes the deletion query and returns how many vertices were deleted. func (cad *CloudflareAccountsDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, cad.sqlExec, cad.mutation, cad.hooks) } // ExecX is like Exec, but panics if an error occurs. func (cad *CloudflareAccountsDelete) ExecX(ctx context.Context) int { n, err := cad.Exec(ctx) if err != nil { panic(err) } return n } func (cad *CloudflareAccountsDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cloudflareaccounts.Table, sqlgraph.NewFieldSpec(cloudflareaccounts.FieldID, field.TypeInt)) if ps := cad.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, cad.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } cad.mutation.done = true return affected, err } // CloudflareAccountsDeleteOne is the builder for deleting a single CloudflareAccounts entity. type CloudflareAccountsDeleteOne struct { cad *CloudflareAccountsDelete } // Where appends a list predicates to the CloudflareAccountsDelete builder. func (cado *CloudflareAccountsDeleteOne) Where(ps ...predicate.CloudflareAccounts) *CloudflareAccountsDeleteOne { cado.cad.mutation.Where(ps...) return cado } // Exec executes the deletion query. func (cado *CloudflareAccountsDeleteOne) Exec(ctx context.Context) error { n, err := cado.cad.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{cloudflareaccounts.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (cado *CloudflareAccountsDeleteOne) ExecX(ctx context.Context) { if err := cado.Exec(ctx); err != nil { panic(err) } }