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