forked from mirrors/homebox
bd321af29f
* new PR tasks * add homebox to know words * formatting * bump deps * generate db models * ts errors * drop id * fix accessor * drop unused time field * change CI * add expected error * add type check * resolve serveral type errors * hoise in CI
88 lines
2.6 KiB
Go
88 lines
2.6 KiB
Go
// 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"
|
|
"github.com/hay-kot/homebox/backend/internal/data/ent/groupinvitationtoken"
|
|
"github.com/hay-kot/homebox/backend/internal/data/ent/predicate"
|
|
)
|
|
|
|
// GroupInvitationTokenDelete is the builder for deleting a GroupInvitationToken entity.
|
|
type GroupInvitationTokenDelete struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *GroupInvitationTokenMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the GroupInvitationTokenDelete builder.
|
|
func (gitd *GroupInvitationTokenDelete) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDelete {
|
|
gitd.mutation.Where(ps...)
|
|
return gitd
|
|
}
|
|
|
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
|
func (gitd *GroupInvitationTokenDelete) Exec(ctx context.Context) (int, error) {
|
|
return withHooks[int, GroupInvitationTokenMutation](ctx, gitd.sqlExec, gitd.mutation, gitd.hooks)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (gitd *GroupInvitationTokenDelete) ExecX(ctx context.Context) int {
|
|
n, err := gitd.Exec(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return n
|
|
}
|
|
|
|
func (gitd *GroupInvitationTokenDelete) sqlExec(ctx context.Context) (int, error) {
|
|
_spec := sqlgraph.NewDeleteSpec(groupinvitationtoken.Table, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID))
|
|
if ps := gitd.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
affected, err := sqlgraph.DeleteNodes(ctx, gitd.driver, _spec)
|
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
gitd.mutation.done = true
|
|
return affected, err
|
|
}
|
|
|
|
// GroupInvitationTokenDeleteOne is the builder for deleting a single GroupInvitationToken entity.
|
|
type GroupInvitationTokenDeleteOne struct {
|
|
gitd *GroupInvitationTokenDelete
|
|
}
|
|
|
|
// Where appends a list predicates to the GroupInvitationTokenDelete builder.
|
|
func (gitdo *GroupInvitationTokenDeleteOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenDeleteOne {
|
|
gitdo.gitd.mutation.Where(ps...)
|
|
return gitdo
|
|
}
|
|
|
|
// Exec executes the deletion query.
|
|
func (gitdo *GroupInvitationTokenDeleteOne) Exec(ctx context.Context) error {
|
|
n, err := gitdo.gitd.Exec(ctx)
|
|
switch {
|
|
case err != nil:
|
|
return err
|
|
case n == 0:
|
|
return &NotFoundError{groupinvitationtoken.Label}
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (gitdo *GroupInvitationTokenDeleteOne) ExecX(ctx context.Context) {
|
|
if err := gitdo.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|