3 Star 0 Fork 0

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
devicedurationelephant_delete.go 2.64 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/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)
}
}
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