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