🎉 init
This commit is contained in:
88
common/ent/scaauthpermissionrule_delete.go
Normal file
88
common/ent/scaauthpermissionrule_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"schisandra-album-cloud-microservices/common/ent/predicate"
|
||||
"schisandra-album-cloud-microservices/common/ent/scaauthpermissionrule"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// ScaAuthPermissionRuleDelete is the builder for deleting a ScaAuthPermissionRule entity.
|
||||
type ScaAuthPermissionRuleDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *ScaAuthPermissionRuleMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the ScaAuthPermissionRuleDelete builder.
|
||||
func (saprd *ScaAuthPermissionRuleDelete) Where(ps ...predicate.ScaAuthPermissionRule) *ScaAuthPermissionRuleDelete {
|
||||
saprd.mutation.Where(ps...)
|
||||
return saprd
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (saprd *ScaAuthPermissionRuleDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, saprd.sqlExec, saprd.mutation, saprd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (saprd *ScaAuthPermissionRuleDelete) ExecX(ctx context.Context) int {
|
||||
n, err := saprd.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (saprd *ScaAuthPermissionRuleDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(scaauthpermissionrule.Table, sqlgraph.NewFieldSpec(scaauthpermissionrule.FieldID, field.TypeInt64))
|
||||
if ps := saprd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, saprd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
saprd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// ScaAuthPermissionRuleDeleteOne is the builder for deleting a single ScaAuthPermissionRule entity.
|
||||
type ScaAuthPermissionRuleDeleteOne struct {
|
||||
saprd *ScaAuthPermissionRuleDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the ScaAuthPermissionRuleDelete builder.
|
||||
func (saprdo *ScaAuthPermissionRuleDeleteOne) Where(ps ...predicate.ScaAuthPermissionRule) *ScaAuthPermissionRuleDeleteOne {
|
||||
saprdo.saprd.mutation.Where(ps...)
|
||||
return saprdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (saprdo *ScaAuthPermissionRuleDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := saprdo.saprd.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{scaauthpermissionrule.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (saprdo *ScaAuthPermissionRuleDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := saprdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user