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