func (m *BeerMutation) SetName(s string) {
	m.name = &s
}
SetName sets the "name" field.
package ent
import (
	"context"
	"fmt"
	"sync"
	"time"
	"github.com/go-kratos/beer-shop/app/catalog/service/internal/biz"
	"github.com/go-kratos/beer-shop/app/catalog/service/internal/data/ent/beer"
	"github.com/go-kratos/beer-shop/app/catalog/service/internal/data/ent/predicate"
	"entgo.io/ent"
)
const (
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne
	TypeBeer = "Beer"
)
type BeerMutation struct {
	config
	op            Op
	typ           string
	id            *int64
	name          *string
	description   *string
	count         *int64
	addcount      *int64
	price         *int64
	addprice      *int64
	images        *[]biz.Image
	created_at    *time.Time
	updated_at    *time.Time
	clearedFields map[string]struct{}
	done          bool
	oldValue      func(context.Context) (*Beer, error)
	predicates    []predicate.Beer
}
var _ ent.Mutation = (*BeerMutation)(nil)
type beerOption func(*BeerMutation)
func newBeerMutation(c config, op Op, opts ...beerOption) *BeerMutation {
	m := &BeerMutation{
		config:        c,
		op:            op,
		typ:           TypeBeer,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}
func withBeerID(id int64) beerOption {
	return func(m *BeerMutation) {
		var (
			err   error
			once  sync.Once
			value *Beer
		)
		m.oldValue = func(ctx context.Context) (*Beer, error) {
			once.Do(func() {
				if m.done {
					err = fmt.Errorf("querying old values post mutation is not allowed")
				} else {
					value, err = m.Client().Beer.Get(ctx, id)
				}
			})
			return value, err
		}
		m.id = &id
	}
}
func withBeer(node *Beer) beerOption {
	return func(m *BeerMutation) {
		m.oldValue = func(context.Context) (*Beer, error) {
			return node, nil
		}
		m.id = &node.ID
	}
}
func (m BeerMutation) Client() *Client {
	client := &Client{config: m.config}
	client.init()
	return client
}
func (m BeerMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, fmt.Errorf("ent: mutation is not running in a transaction")
	}
	tx := &Tx{config: m.config}
	tx.init()
	return tx, nil
}
func (m *BeerMutation) SetID(id int64) {
	m.id = &id
}
func (m *BeerMutation) ID() (id int64, exists bool) {
	if m.id == nil {
		return
	}
	return *m.id, true
}