Files
schisandra-album-cloud-micr…/common/ent/scaauthusersocial_delete.go
landaiqing 97ca3fc7b0 🎉 init
2024-11-12 17:00:16 +08:00

89 lines
2.5 KiB
Go

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