3 Star 0 Fork 0

广东宇凌网络科技有限公司 / simple-iot-data-rpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
deviceofflinetime_delete.go 2.52 KB
一键复制 编辑 原始数据 按行查看 历史
HienGee 提交于 2024-04-26 11:27 . init
// 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/deviceofflinetime"
"gitee.com/yuLingNet/simple-iot-data-rpc/ent/predicate"
)
// DeviceOfflineTimeDelete is the builder for deleting a DeviceOfflineTime entity.
type DeviceOfflineTimeDelete struct {
config
hooks []Hook
mutation *DeviceOfflineTimeMutation
}
// Where appends a list predicates to the DeviceOfflineTimeDelete builder.
func (dotd *DeviceOfflineTimeDelete) Where(ps ...predicate.DeviceOfflineTime) *DeviceOfflineTimeDelete {
dotd.mutation.Where(ps...)
return dotd
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (dotd *DeviceOfflineTimeDelete) 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 *DeviceOfflineTimeDelete) ExecX(ctx context.Context) int {
n, err := dotd.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (dotd *DeviceOfflineTimeDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(deviceofflinetime.Table, sqlgraph.NewFieldSpec(deviceofflinetime.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
}
// DeviceOfflineTimeDeleteOne is the builder for deleting a single DeviceOfflineTime entity.
type DeviceOfflineTimeDeleteOne struct {
dotd *DeviceOfflineTimeDelete
}
// Where appends a list predicates to the DeviceOfflineTimeDelete builder.
func (dotdo *DeviceOfflineTimeDeleteOne) Where(ps ...predicate.DeviceOfflineTime) *DeviceOfflineTimeDeleteOne {
dotdo.dotd.mutation.Where(ps...)
return dotdo
}
// Exec executes the deletion query.
func (dotdo *DeviceOfflineTimeDeleteOne) Exec(ctx context.Context) error {
n, err := dotdo.dotd.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{deviceofflinetime.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (dotdo *DeviceOfflineTimeDeleteOne) ExecX(ctx context.Context) {
if err := dotdo.Exec(ctx); err != nil {
panic(err)
}
}
Go
1
https://gitee.com/yuLingNet/simple-iot-data-rpc.git
git@gitee.com:yuLingNet/simple-iot-data-rpc.git
yuLingNet
simple-iot-data-rpc
simple-iot-data-rpc
39cb53be4684

搜索帮助

53164aa7 5694891 3bd8fe86 5694891