func (cu *CardUpdate) ExecX(ctx context.Context) {
	if err := cu.Exec(ctx); err != nil {
		panic(err)
	}
}
ExecX is like Exec, but panics if an error occurs.
package ent
import (
	"context"
	"fmt"
	"time"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/card"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/predicate"
	"github.com/go-kratos/beer-shop/app/user/service/internal/data/ent/user"
)
type CardUpdate struct {
	config
	hooks    []Hook
	mutation *CardMutation
}
func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate {
	cu.mutation.predicates = append(cu.mutation.predicates, ps...)
	return cu
}
func (cu *CardUpdate) SetName(s string) *CardUpdate {
	cu.mutation.SetName(s)
	return cu
}
func (cu *CardUpdate) SetCardNo(s string) *CardUpdate {
	cu.mutation.SetCardNo(s)
	return cu
}
func (cu *CardUpdate) SetCcv(s string) *CardUpdate {
	cu.mutation.SetCcv(s)
	return cu
}
func (cu *CardUpdate) SetExpires(s string) *CardUpdate {
	cu.mutation.SetExpires(s)
	return cu
}
func (cu *CardUpdate) SetCreatedAt(t time.Time) *CardUpdate {
	cu.mutation.SetCreatedAt(t)
	return cu
}
func (cu *CardUpdate) SetNillableCreatedAt(t *time.Time) *CardUpdate {
	if t != nil {
		cu.SetCreatedAt(*t)
	}
	return cu
}
func (cu *CardUpdate) SetUpdatedAt(t time.Time) *CardUpdate {
	cu.mutation.SetUpdatedAt(t)
	return cu
}
func (cu *CardUpdate) SetNillableUpdatedAt(t *time.Time) *CardUpdate {
	if t != nil {
		cu.SetUpdatedAt(*t)
	}
	return cu
}
func (cu *CardUpdate) SetUserID(id int64) *CardUpdate {
	cu.mutation.SetUserID(id)
	return cu
}
func (cu *CardUpdate) SetNillableUserID(id *int64) *CardUpdate {
	if id != nil {
		cu = cu.SetUserID(*id)
	}
	return cu
}
func (cu *CardUpdate) SetUser(u *User) *CardUpdate {
	return cu.SetUserID(u.ID)
}
func (cu *CardUpdate) Mutation() *CardMutation {
	return cu.mutation
}
func (cu *CardUpdate) ClearUser() *CardUpdate {
	cu.mutation.ClearUser()
	return cu
}
func (cu *CardUpdate) Save(ctx context.Context) (int, error) {
	var (
		err      error
		affected int
	)
	if len(cu.hooks) == 0 {
		affected, err = cu.sqlSave(ctx)
	} else {
		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
			mutation, ok := m.(*CardMutation)
			if !ok {
				return nil, fmt.Errorf("unexpected mutation type %T", m)
			}
			cu.mutation = mutation
			affected, err = cu.sqlSave(ctx)
			mutation.done = true
			return affected, err
		})
		for i := len(cu.hooks) - 1; i >= 0; i-- {
			mut = cu.hooks[i](mut)
		}
		if _, err := mut.Mutate(ctx, cu.mutation); err != nil {
			return 0, err
		}
	}
	return affected, err
}
func (cu *CardUpdate) SaveX(ctx context.Context) int {
	affected, err := cu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}
func (cu *CardUpdate) Exec(ctx context.Context) error {
	_, err := cu.Save(ctx)
	return err
}