func (c *WithModifiedFieldClient) Hooks() []Hook {
	return c.hooks.WithModifiedField
}
Hooks returns the client hooks.
package ent
import (
	"context"
	"fmt"
	"log"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/migrate"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/user"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withfields"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withmodifiedfield"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withnilfields"
	"entgo.io/contrib/schemast/internal/mutatetest/ent/withoutfields"
	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
)
type Client struct {
	config
	Schema *migrate.Schema
	User *UserClient
	WithFields *WithFieldsClient
	WithModifiedField *WithModifiedFieldClient
	WithNilFields *WithNilFieldsClient
	WithoutFields *WithoutFieldsClient
}
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.User = NewUserClient(c.config)
	c.WithFields = NewWithFieldsClient(c.config)
	c.WithModifiedField = NewWithModifiedFieldClient(c.config)
	c.WithNilFields = NewWithNilFieldsClient(c.config)
	c.WithoutFields = NewWithoutFieldsClient(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,
		User:              NewUserClient(cfg),
		WithFields:        NewWithFieldsClient(cfg),
		WithModifiedField: NewWithModifiedFieldClient(cfg),
		WithNilFields:     NewWithNilFieldsClient(cfg),
		WithoutFields:     NewWithoutFieldsClient(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,
		User:              NewUserClient(cfg),
		WithFields:        NewWithFieldsClient(cfg),
		WithModifiedField: NewWithModifiedFieldClient(cfg),
		WithNilFields:     NewWithNilFieldsClient(cfg),
		WithoutFields:     NewWithoutFieldsClient(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.User.Use(hooks...)
	c.WithFields.Use(hooks...)
	c.WithModifiedField.Use(hooks...)
	c.WithNilFields.Use(hooks...)
	c.WithoutFields.Use(hooks...)
}
type UserClient struct {
	config
}
func NewUserClient(c config) *UserClient {
	return &UserClient{config: c}
}
func (c *UserClient) Use(hooks ...Hook) {
	c.hooks.User = append(c.hooks.User, hooks...)
}
func (c *UserClient) Create() *UserCreate {
	mutation := newUserMutation(c.config, OpCreate)
	return &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {
	return &UserCreateBulk{config: c.config, builders: builders}
}
func (c *UserClient) Update() *UserUpdate {
	mutation := newUserMutation(c.config, OpUpdate)
	return &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {
	mutation := newUserMutation(c.config, OpUpdateOne, withUser(u))
	return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {
	mutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))
	return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *UserClient) Delete() *UserDelete {
	mutation := newUserMutation(c.config, OpDelete)
	return &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne {
	return c.DeleteOneID(u.ID)
}
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne {
	builder := c.Delete().Where(user.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &UserDeleteOne{builder}
}
func (c *UserClient) Query() *UserQuery {
	return &UserQuery{
		config: c.config,
	}
}
func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {
	return c.Query().Where(user.ID(id)).Only(ctx)
}
func (c *UserClient) GetX(ctx context.Context, id int) *User {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}
func (c *UserClient) Hooks() []Hook {
	return c.hooks.User
}
type WithFieldsClient struct {
	config
}
func NewWithFieldsClient(c config) *WithFieldsClient {
	return &WithFieldsClient{config: c}
}
func (c *WithFieldsClient) Use(hooks ...Hook) {
	c.hooks.WithFields = append(c.hooks.WithFields, hooks...)
}
func (c *WithFieldsClient) Create() *WithFieldsCreate {
	mutation := newWithFieldsMutation(c.config, OpCreate)
	return &WithFieldsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithFieldsClient) CreateBulk(builders ...*WithFieldsCreate) *WithFieldsCreateBulk {
	return &WithFieldsCreateBulk{config: c.config, builders: builders}
}
func (c *WithFieldsClient) Update() *WithFieldsUpdate {
	mutation := newWithFieldsMutation(c.config, OpUpdate)
	return &WithFieldsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithFieldsClient) UpdateOne(wf *WithFields) *WithFieldsUpdateOne {
	mutation := newWithFieldsMutation(c.config, OpUpdateOne, withWithFields(wf))
	return &WithFieldsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithFieldsClient) UpdateOneID(id int) *WithFieldsUpdateOne {
	mutation := newWithFieldsMutation(c.config, OpUpdateOne, withWithFieldsID(id))
	return &WithFieldsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithFieldsClient) Delete() *WithFieldsDelete {
	mutation := newWithFieldsMutation(c.config, OpDelete)
	return &WithFieldsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithFieldsClient) DeleteOne(wf *WithFields) *WithFieldsDeleteOne {
	return c.DeleteOneID(wf.ID)
}
func (c *WithFieldsClient) DeleteOneID(id int) *WithFieldsDeleteOne {
	builder := c.Delete().Where(withfields.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &WithFieldsDeleteOne{builder}
}
func (c *WithFieldsClient) Query() *WithFieldsQuery {
	return &WithFieldsQuery{
		config: c.config,
	}
}
func (c *WithFieldsClient) Get(ctx context.Context, id int) (*WithFields, error) {
	return c.Query().Where(withfields.ID(id)).Only(ctx)
}
func (c *WithFieldsClient) GetX(ctx context.Context, id int) *WithFields {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}
func (c *WithFieldsClient) Hooks() []Hook {
	return c.hooks.WithFields
}
type WithModifiedFieldClient struct {
	config
}
func NewWithModifiedFieldClient(c config) *WithModifiedFieldClient {
	return &WithModifiedFieldClient{config: c}
}
func (c *WithModifiedFieldClient) Use(hooks ...Hook) {
	c.hooks.WithModifiedField = append(c.hooks.WithModifiedField, hooks...)
}
func (c *WithModifiedFieldClient) Create() *WithModifiedFieldCreate {
	mutation := newWithModifiedFieldMutation(c.config, OpCreate)
	return &WithModifiedFieldCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithModifiedFieldClient) CreateBulk(builders ...*WithModifiedFieldCreate) *WithModifiedFieldCreateBulk {
	return &WithModifiedFieldCreateBulk{config: c.config, builders: builders}
}
func (c *WithModifiedFieldClient) Update() *WithModifiedFieldUpdate {
	mutation := newWithModifiedFieldMutation(c.config, OpUpdate)
	return &WithModifiedFieldUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithModifiedFieldClient) UpdateOne(wmf *WithModifiedField) *WithModifiedFieldUpdateOne {
	mutation := newWithModifiedFieldMutation(c.config, OpUpdateOne, withWithModifiedField(wmf))
	return &WithModifiedFieldUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithModifiedFieldClient) UpdateOneID(id int) *WithModifiedFieldUpdateOne {
	mutation := newWithModifiedFieldMutation(c.config, OpUpdateOne, withWithModifiedFieldID(id))
	return &WithModifiedFieldUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithModifiedFieldClient) Delete() *WithModifiedFieldDelete {
	mutation := newWithModifiedFieldMutation(c.config, OpDelete)
	return &WithModifiedFieldDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
func (c *WithModifiedFieldClient) DeleteOne(wmf *WithModifiedField) *WithModifiedFieldDeleteOne {
	return c.DeleteOneID(wmf.ID)
}
func (c *WithModifiedFieldClient) DeleteOneID(id int) *WithModifiedFieldDeleteOne {
	builder := c.Delete().Where(withmodifiedfield.ID(id))
	builder.mutation.id = &id
	builder.mutation.op = OpDeleteOne
	return &WithModifiedFieldDeleteOne{builder}
}
func (c *WithModifiedFieldClient) Query() *WithModifiedFieldQuery {
	return &WithModifiedFieldQuery{
		config: c.config,
	}
}
func (c *WithModifiedFieldClient) Get(ctx context.Context, id int) (*WithModifiedField, error) {
	return c.Query().Where(withmodifiedfield.ID(id)).Only(ctx)
}
func (c *WithModifiedFieldClient) GetX(ctx context.Context, id int) *WithModifiedField {
	obj, err := c.Get(ctx, id)
	if err != nil {
		panic(err)
	}
	return obj
}
func (c *WithModifiedFieldClient) QueryOwner(wmf *WithModifiedField) *UserQuery {
	query := &UserQuery{config: c.config}
	query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
		id := wmf.ID
		step := sqlgraph.NewStep(
			sqlgraph.From(withmodifiedfield.Table, withmodifiedfield.FieldID, id),
			sqlgraph.To(user.Table, user.FieldID),
			sqlgraph.Edge(sqlgraph.M2O, false, withmodifiedfield.OwnerTable, withmodifiedfield.OwnerColumn),
		)
		fromV = sqlgraph.Neighbors(wmf.driver.Dialect(), step)
		return fromV, nil
	}
	return query
}