12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "wechat-api/ent/predicate"
- "wechat-api/ent/wxcardvisit"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // WxCardVisitDelete is the builder for deleting a WxCardVisit entity.
- type WxCardVisitDelete struct {
- config
- hooks []Hook
- mutation *WxCardVisitMutation
- }
- // Where appends a list predicates to the WxCardVisitDelete builder.
- func (wcvd *WxCardVisitDelete) Where(ps ...predicate.WxCardVisit) *WxCardVisitDelete {
- wcvd.mutation.Where(ps...)
- return wcvd
- }
- // Exec executes the deletion query and returns how many vertices were deleted.
- func (wcvd *WxCardVisitDelete) Exec(ctx context.Context) (int, error) {
- return withHooks(ctx, wcvd.sqlExec, wcvd.mutation, wcvd.hooks)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (wcvd *WxCardVisitDelete) ExecX(ctx context.Context) int {
- n, err := wcvd.Exec(ctx)
- if err != nil {
- panic(err)
- }
- return n
- }
- func (wcvd *WxCardVisitDelete) sqlExec(ctx context.Context) (int, error) {
- _spec := sqlgraph.NewDeleteSpec(wxcardvisit.Table, sqlgraph.NewFieldSpec(wxcardvisit.FieldID, field.TypeUint64))
- if ps := wcvd.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- affected, err := sqlgraph.DeleteNodes(ctx, wcvd.driver, _spec)
- if err != nil && sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- wcvd.mutation.done = true
- return affected, err
- }
- // WxCardVisitDeleteOne is the builder for deleting a single WxCardVisit entity.
- type WxCardVisitDeleteOne struct {
- wcvd *WxCardVisitDelete
- }
- // Where appends a list predicates to the WxCardVisitDelete builder.
- func (wcvdo *WxCardVisitDeleteOne) Where(ps ...predicate.WxCardVisit) *WxCardVisitDeleteOne {
- wcvdo.wcvd.mutation.Where(ps...)
- return wcvdo
- }
- // Exec executes the deletion query.
- func (wcvdo *WxCardVisitDeleteOne) Exec(ctx context.Context) error {
- n, err := wcvdo.wcvd.Exec(ctx)
- switch {
- case err != nil:
- return err
- case n == 0:
- return &NotFoundError{wxcardvisit.Label}
- default:
- return nil
- }
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (wcvdo *WxCardVisitDeleteOne) ExecX(ctx context.Context) {
- if err := wcvdo.Exec(ctx); err != nil {
- panic(err)
- }
- }
|