// 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" "tangled.sh/seiso.moe/aletheia.directory/ent/predicate" "tangled.sh/seiso.moe/aletheia.directory/ent/syncstatus" ) // SyncStatusDelete is the builder for deleting a SyncStatus entity. type SyncStatusDelete struct { config hooks []Hook mutation *SyncStatusMutation } // Where appends a list predicates to the SyncStatusDelete builder. func (ssd *SyncStatusDelete) Where(ps ...predicate.SyncStatus) *SyncStatusDelete { ssd.mutation.Where(ps...) return ssd } // Exec executes the deletion query and returns how many vertices were deleted. func (ssd *SyncStatusDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, ssd.sqlExec, ssd.mutation, ssd.hooks) } // ExecX is like Exec, but panics if an error occurs. func (ssd *SyncStatusDelete) ExecX(ctx context.Context) int { n, err := ssd.Exec(ctx) if err != nil { panic(err) } return n } func (ssd *SyncStatusDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(syncstatus.Table, sqlgraph.NewFieldSpec(syncstatus.FieldID, field.TypeInt)) if ps := ssd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, ssd.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } ssd.mutation.done = true return affected, err } // SyncStatusDeleteOne is the builder for deleting a single SyncStatus entity. type SyncStatusDeleteOne struct { ssd *SyncStatusDelete } // Where appends a list predicates to the SyncStatusDelete builder. func (ssdo *SyncStatusDeleteOne) Where(ps ...predicate.SyncStatus) *SyncStatusDeleteOne { ssdo.ssd.mutation.Where(ps...) return ssdo } // Exec executes the deletion query. func (ssdo *SyncStatusDeleteOne) Exec(ctx context.Context) error { n, err := ssdo.ssd.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{syncstatus.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (ssdo *SyncStatusDeleteOne) ExecX(ctx context.Context) { if err := ssdo.Exec(ctx); err != nil { panic(err) } }