代码拉取完成,页面将自动刷新
// 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"
"gitee.com/yuLingNet/simple-iot-data-rpc/ent/devicedurationelephant"
"gitee.com/yuLingNet/simple-iot-data-rpc/ent/predicate"
)
// DeviceDurationElephantDelete is the builder for deleting a DeviceDurationElephant entity.
type DeviceDurationElephantDelete struct {
config
hooks []Hook
mutation *DeviceDurationElephantMutation
}
// Where appends a list predicates to the DeviceDurationElephantDelete builder.
func (dded *DeviceDurationElephantDelete) Where(ps ...predicate.DeviceDurationElephant) *DeviceDurationElephantDelete {
dded.mutation.Where(ps...)
return dded
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (dded *DeviceDurationElephantDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, dded.sqlExec, dded.mutation, dded.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (dded *DeviceDurationElephantDelete) ExecX(ctx context.Context) int {
n, err := dded.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (dded *DeviceDurationElephantDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(devicedurationelephant.Table, sqlgraph.NewFieldSpec(devicedurationelephant.FieldID, field.TypeUint64))
if ps := dded.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, dded.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
dded.mutation.done = true
return affected, err
}
// DeviceDurationElephantDeleteOne is the builder for deleting a single DeviceDurationElephant entity.
type DeviceDurationElephantDeleteOne struct {
dded *DeviceDurationElephantDelete
}
// Where appends a list predicates to the DeviceDurationElephantDelete builder.
func (ddedo *DeviceDurationElephantDeleteOne) Where(ps ...predicate.DeviceDurationElephant) *DeviceDurationElephantDeleteOne {
ddedo.dded.mutation.Where(ps...)
return ddedo
}
// Exec executes the deletion query.
func (ddedo *DeviceDurationElephantDeleteOne) Exec(ctx context.Context) error {
n, err := ddedo.dded.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{devicedurationelephant.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (ddedo *DeviceDurationElephantDeleteOne) ExecX(ctx context.Context) {
if err := ddedo.Exec(ctx); err != nil {
panic(err)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。