func (c *BeerClient) Delete() *BeerDelete {
	mutation := newBeerMutation(c.config, OpDelete)
	return &BeerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
Delete returns a delete builder for Beer.
package ent
import (
	"context"
	"fmt"
	"log"
	"github.com/go-kratos/beer-shop/app/catalog/service/internal/data/ent/migrate"
	"github.com/go-kratos/beer-shop/app/catalog/service/internal/data/ent/beer"
	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
)
type Client struct {
	config
	Schema *migrate.Schema
	Beer *BeerClient
}
func NewClient(opts ...Option) *Client {
	cfg := config{log: log.Println, hooks: &hooks{}}
	cfg.options(opts...)
	client := &Client{config: cfg}
	client.init()
	return client
}
func (c *Client) init() {
	c.Schema = migrate.NewSchema(c.driver)
	c.Beer = NewBeerClient(c.config)
}
func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
	switch driverName {
	case dialect.MySQL, dialect.Postgres, dialect.SQLite:
		drv, err := sql.Open(driverName, dataSourceName)
		if err != nil {
			return nil, err
		}
		return NewClient(append(options, Driver(drv))...), nil
	default:
		return nil, fmt.Errorf("unsupported driver: %q", driverName)
	}
}
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")
	}
	tx, err := newTx(ctx, c.driver)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = tx
	return &Tx{
		ctx:    ctx,
		config: cfg,
		Beer:   NewBeerClient(cfg),
	}, nil
}
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
	if _, ok := c.driver.(*txDriver); ok {
		return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")
	}
	tx, err := c.driver.(interface {
		BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
	}).BeginTx(ctx, opts)
	if err != nil {
		return nil, fmt.Errorf("ent: starting a transaction: %w", err)
	}
	cfg := c.config
	cfg.driver = &txDriver{tx: tx, drv: c.driver}
	return &Tx{
		config: cfg,
		Beer:   NewBeerClient(cfg),
	}, nil
}
func (c *Client) Debug() *Client {
	if c.debug {
		return c
	}
	cfg := c.config
	cfg.driver = dialect.Debug(c.driver, c.log)
	client := &Client{config: cfg}
	client.init()
	return client
}
func (c *Client) Close() error {
	return c.driver.Close()
}
func (c *Client) Use(hooks ...Hook) {
	c.Beer.Use(hooks...)
}
type BeerClient struct {
	config
}
func NewBeerClient(c config) *BeerClient {
	return &BeerClient{config: c}
}
func (c *BeerClient) Use(hooks ...Hook) {
	c.hooks.Beer = append(c.hooks.Beer, hooks...)
}
func (c *BeerClient) Create() *BeerCreate {
	mutation := newBeerMutation(c.config, OpCreate)
	return &BeerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *BeerClient) CreateBulk(builders ...*BeerCreate) *BeerCreateBulk {
	return &BeerCreateBulk{config: c.config, builders: builders}
}
func (c *BeerClient) Update() *BeerUpdate {
	mutation := newBeerMutation(c.config, OpUpdate)
	return &BeerUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *BeerClient) UpdateOne(b *Beer) *BeerUpdateOne {
	mutation := newBeerMutation(c.config, OpUpdateOne, withBeer(b))
	return &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *BeerClient) UpdateOneID(id int64) *BeerUpdateOne {
	mutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))
	return &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}