Files
epic-ent/internal/ent/client.go

1486 lines
59 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"log"
"reflect"
"epic-ent/internal/ent/migrate"
"epic-ent/internal/ent/epicartifactinfo"
"epic-ent/internal/ent/epicgvgattackteams"
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
"epic-ent/internal/ent/epicgvgdefenseteams"
"epic-ent/internal/ent/epicheroinfo"
"epic-ent/internal/ent/epicherouserbuild"
"epic-ent/internal/ent/epici18nmappings"
"epic-ent/internal/ent/fribbleheroset"
"epic-ent/internal/ent/gearsetinfo"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
)
// Client is the client that holds all ent builders.
type Client struct {
config
// Schema is the client for creating, migrating and dropping schema.
Schema *migrate.Schema
// EpicArtifactInfo is the client for interacting with the EpicArtifactInfo builders.
EpicArtifactInfo *EpicArtifactInfoClient
// EpicGvgAttackTeams is the client for interacting with the EpicGvgAttackTeams builders.
EpicGvgAttackTeams *EpicGvgAttackTeamsClient
// EpicGvgDefenseAttackMapping is the client for interacting with the EpicGvgDefenseAttackMapping builders.
EpicGvgDefenseAttackMapping *EpicGvgDefenseAttackMappingClient
// EpicGvgDefenseTeams is the client for interacting with the EpicGvgDefenseTeams builders.
EpicGvgDefenseTeams *EpicGvgDefenseTeamsClient
// EpicHeroInfo is the client for interacting with the EpicHeroInfo builders.
EpicHeroInfo *EpicHeroInfoClient
// EpicHeroUserBuild is the client for interacting with the EpicHeroUserBuild builders.
EpicHeroUserBuild *EpicHeroUserBuildClient
// EpicI18NMappings is the client for interacting with the EpicI18NMappings builders.
EpicI18NMappings *EpicI18NMappingsClient
// FribbleHeroSet is the client for interacting with the FribbleHeroSet builders.
FribbleHeroSet *FribbleHeroSetClient
// GearSetInfo is the client for interacting with the GearSetInfo builders.
GearSetInfo *GearSetInfoClient
}
// NewClient creates a new client configured with the given options.
func NewClient(opts ...Option) *Client {
client := &Client{config: newConfig(opts...)}
client.init()
return client
}
func (c *Client) init() {
c.Schema = migrate.NewSchema(c.driver)
c.EpicArtifactInfo = NewEpicArtifactInfoClient(c.config)
c.EpicGvgAttackTeams = NewEpicGvgAttackTeamsClient(c.config)
c.EpicGvgDefenseAttackMapping = NewEpicGvgDefenseAttackMappingClient(c.config)
c.EpicGvgDefenseTeams = NewEpicGvgDefenseTeamsClient(c.config)
c.EpicHeroInfo = NewEpicHeroInfoClient(c.config)
c.EpicHeroUserBuild = NewEpicHeroUserBuildClient(c.config)
c.EpicI18NMappings = NewEpicI18NMappingsClient(c.config)
c.FribbleHeroSet = NewFribbleHeroSetClient(c.config)
c.GearSetInfo = NewGearSetInfoClient(c.config)
}
type (
// config is the configuration for the client and its builder.
config struct {
// driver used for executing database requests.
driver dialect.Driver
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...any)
// hooks to execute on mutations.
hooks *hooks
// interceptors to execute on queries.
inters *inters
}
// Option function to configure the client.
Option func(*config)
)
// newConfig creates a new config for the client.
func newConfig(opts ...Option) config {
cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
cfg.options(opts...)
return cfg
}
// options applies the options on the config object.
func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.debug = true
}
}
// Log sets the logging function for debug mode.
func Log(fn func(...any)) Option {
return func(c *config) {
c.log = fn
}
}
// Driver configures the client driver.
func Driver(driver dialect.Driver) Option {
return func(c *config) {
c.driver = driver
}
}
// Open opens a database/sql.DB specified by the driver name and
// the data source name, and returns a new client attached to it.
// Optional parameters can be added for configuring the client.
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)
}
}
// ErrTxStarted is returned when trying to start a new transaction from a transactional client.
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
// Tx returns a new transactional client. The provided context
// is used until the transaction is committed or rolled back.
func (c *Client) Tx(ctx context.Context) (*Tx, error) {
if _, ok := c.driver.(*txDriver); ok {
return nil, ErrTxStarted
}
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,
EpicArtifactInfo: NewEpicArtifactInfoClient(cfg),
EpicGvgAttackTeams: NewEpicGvgAttackTeamsClient(cfg),
EpicGvgDefenseAttackMapping: NewEpicGvgDefenseAttackMappingClient(cfg),
EpicGvgDefenseTeams: NewEpicGvgDefenseTeamsClient(cfg),
EpicHeroInfo: NewEpicHeroInfoClient(cfg),
EpicHeroUserBuild: NewEpicHeroUserBuildClient(cfg),
EpicI18NMappings: NewEpicI18NMappingsClient(cfg),
FribbleHeroSet: NewFribbleHeroSetClient(cfg),
GearSetInfo: NewGearSetInfoClient(cfg),
}, nil
}
// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
if _, ok := c.driver.(*txDriver); ok {
return nil, errors.New("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{
ctx: ctx,
config: cfg,
EpicArtifactInfo: NewEpicArtifactInfoClient(cfg),
EpicGvgAttackTeams: NewEpicGvgAttackTeamsClient(cfg),
EpicGvgDefenseAttackMapping: NewEpicGvgDefenseAttackMappingClient(cfg),
EpicGvgDefenseTeams: NewEpicGvgDefenseTeamsClient(cfg),
EpicHeroInfo: NewEpicHeroInfoClient(cfg),
EpicHeroUserBuild: NewEpicHeroUserBuildClient(cfg),
EpicI18NMappings: NewEpicI18NMappingsClient(cfg),
FribbleHeroSet: NewFribbleHeroSetClient(cfg),
GearSetInfo: NewGearSetInfoClient(cfg),
}, nil
}
// Debug returns a new debug-client. It's used to get verbose logging on specific operations.
//
// client.Debug().
// EpicArtifactInfo.
// Query().
// Count(ctx)
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
}
// Close closes the database connection and prevents new queries from starting.
func (c *Client) Close() error {
return c.driver.Close()
}
// Use adds the mutation hooks to all the entity clients.
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
func (c *Client) Use(hooks ...Hook) {
for _, n := range []interface{ Use(...Hook) }{
c.EpicArtifactInfo, c.EpicGvgAttackTeams, c.EpicGvgDefenseAttackMapping,
c.EpicGvgDefenseTeams, c.EpicHeroInfo, c.EpicHeroUserBuild, c.EpicI18NMappings,
c.FribbleHeroSet, c.GearSetInfo,
} {
n.Use(hooks...)
}
}
// Intercept adds the query interceptors to all the entity clients.
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (c *Client) Intercept(interceptors ...Interceptor) {
for _, n := range []interface{ Intercept(...Interceptor) }{
c.EpicArtifactInfo, c.EpicGvgAttackTeams, c.EpicGvgDefenseAttackMapping,
c.EpicGvgDefenseTeams, c.EpicHeroInfo, c.EpicHeroUserBuild, c.EpicI18NMappings,
c.FribbleHeroSet, c.GearSetInfo,
} {
n.Intercept(interceptors...)
}
}
// Mutate implements the ent.Mutator interface.
func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
switch m := m.(type) {
case *EpicArtifactInfoMutation:
return c.EpicArtifactInfo.mutate(ctx, m)
case *EpicGvgAttackTeamsMutation:
return c.EpicGvgAttackTeams.mutate(ctx, m)
case *EpicGvgDefenseAttackMappingMutation:
return c.EpicGvgDefenseAttackMapping.mutate(ctx, m)
case *EpicGvgDefenseTeamsMutation:
return c.EpicGvgDefenseTeams.mutate(ctx, m)
case *EpicHeroInfoMutation:
return c.EpicHeroInfo.mutate(ctx, m)
case *EpicHeroUserBuildMutation:
return c.EpicHeroUserBuild.mutate(ctx, m)
case *EpicI18NMappingsMutation:
return c.EpicI18NMappings.mutate(ctx, m)
case *FribbleHeroSetMutation:
return c.FribbleHeroSet.mutate(ctx, m)
case *GearSetInfoMutation:
return c.GearSetInfo.mutate(ctx, m)
default:
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
}
}
// EpicArtifactInfoClient is a client for the EpicArtifactInfo schema.
type EpicArtifactInfoClient struct {
config
}
// NewEpicArtifactInfoClient returns a client for the EpicArtifactInfo from the given config.
func NewEpicArtifactInfoClient(c config) *EpicArtifactInfoClient {
return &EpicArtifactInfoClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicartifactinfo.Hooks(f(g(h())))`.
func (c *EpicArtifactInfoClient) Use(hooks ...Hook) {
c.hooks.EpicArtifactInfo = append(c.hooks.EpicArtifactInfo, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicartifactinfo.Intercept(f(g(h())))`.
func (c *EpicArtifactInfoClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicArtifactInfo = append(c.inters.EpicArtifactInfo, interceptors...)
}
// Create returns a builder for creating a EpicArtifactInfo entity.
func (c *EpicArtifactInfoClient) Create() *EpicArtifactInfoCreate {
mutation := newEpicArtifactInfoMutation(c.config, OpCreate)
return &EpicArtifactInfoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicArtifactInfo entities.
func (c *EpicArtifactInfoClient) CreateBulk(builders ...*EpicArtifactInfoCreate) *EpicArtifactInfoCreateBulk {
return &EpicArtifactInfoCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicArtifactInfoClient) MapCreateBulk(slice any, setFunc func(*EpicArtifactInfoCreate, int)) *EpicArtifactInfoCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicArtifactInfoCreateBulk{err: fmt.Errorf("calling to EpicArtifactInfoClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicArtifactInfoCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicArtifactInfoCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicArtifactInfo.
func (c *EpicArtifactInfoClient) Update() *EpicArtifactInfoUpdate {
mutation := newEpicArtifactInfoMutation(c.config, OpUpdate)
return &EpicArtifactInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicArtifactInfoClient) UpdateOne(_m *EpicArtifactInfo) *EpicArtifactInfoUpdateOne {
mutation := newEpicArtifactInfoMutation(c.config, OpUpdateOne, withEpicArtifactInfo(_m))
return &EpicArtifactInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicArtifactInfoClient) UpdateOneID(id int64) *EpicArtifactInfoUpdateOne {
mutation := newEpicArtifactInfoMutation(c.config, OpUpdateOne, withEpicArtifactInfoID(id))
return &EpicArtifactInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicArtifactInfo.
func (c *EpicArtifactInfoClient) Delete() *EpicArtifactInfoDelete {
mutation := newEpicArtifactInfoMutation(c.config, OpDelete)
return &EpicArtifactInfoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicArtifactInfoClient) DeleteOne(_m *EpicArtifactInfo) *EpicArtifactInfoDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicArtifactInfoClient) DeleteOneID(id int64) *EpicArtifactInfoDeleteOne {
builder := c.Delete().Where(epicartifactinfo.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicArtifactInfoDeleteOne{builder}
}
// Query returns a query builder for EpicArtifactInfo.
func (c *EpicArtifactInfoClient) Query() *EpicArtifactInfoQuery {
return &EpicArtifactInfoQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicArtifactInfo},
inters: c.Interceptors(),
}
}
// Get returns a EpicArtifactInfo entity by its id.
func (c *EpicArtifactInfoClient) Get(ctx context.Context, id int64) (*EpicArtifactInfo, error) {
return c.Query().Where(epicartifactinfo.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicArtifactInfoClient) GetX(ctx context.Context, id int64) *EpicArtifactInfo {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicArtifactInfoClient) Hooks() []Hook {
return c.hooks.EpicArtifactInfo
}
// Interceptors returns the client interceptors.
func (c *EpicArtifactInfoClient) Interceptors() []Interceptor {
return c.inters.EpicArtifactInfo
}
func (c *EpicArtifactInfoClient) mutate(ctx context.Context, m *EpicArtifactInfoMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicArtifactInfoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicArtifactInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicArtifactInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicArtifactInfoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicArtifactInfo mutation op: %q", m.Op())
}
}
// EpicGvgAttackTeamsClient is a client for the EpicGvgAttackTeams schema.
type EpicGvgAttackTeamsClient struct {
config
}
// NewEpicGvgAttackTeamsClient returns a client for the EpicGvgAttackTeams from the given config.
func NewEpicGvgAttackTeamsClient(c config) *EpicGvgAttackTeamsClient {
return &EpicGvgAttackTeamsClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicgvgattackteams.Hooks(f(g(h())))`.
func (c *EpicGvgAttackTeamsClient) Use(hooks ...Hook) {
c.hooks.EpicGvgAttackTeams = append(c.hooks.EpicGvgAttackTeams, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicgvgattackteams.Intercept(f(g(h())))`.
func (c *EpicGvgAttackTeamsClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicGvgAttackTeams = append(c.inters.EpicGvgAttackTeams, interceptors...)
}
// Create returns a builder for creating a EpicGvgAttackTeams entity.
func (c *EpicGvgAttackTeamsClient) Create() *EpicGvgAttackTeamsCreate {
mutation := newEpicGvgAttackTeamsMutation(c.config, OpCreate)
return &EpicGvgAttackTeamsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicGvgAttackTeams entities.
func (c *EpicGvgAttackTeamsClient) CreateBulk(builders ...*EpicGvgAttackTeamsCreate) *EpicGvgAttackTeamsCreateBulk {
return &EpicGvgAttackTeamsCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicGvgAttackTeamsClient) MapCreateBulk(slice any, setFunc func(*EpicGvgAttackTeamsCreate, int)) *EpicGvgAttackTeamsCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicGvgAttackTeamsCreateBulk{err: fmt.Errorf("calling to EpicGvgAttackTeamsClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicGvgAttackTeamsCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicGvgAttackTeamsCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicGvgAttackTeams.
func (c *EpicGvgAttackTeamsClient) Update() *EpicGvgAttackTeamsUpdate {
mutation := newEpicGvgAttackTeamsMutation(c.config, OpUpdate)
return &EpicGvgAttackTeamsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicGvgAttackTeamsClient) UpdateOne(_m *EpicGvgAttackTeams) *EpicGvgAttackTeamsUpdateOne {
mutation := newEpicGvgAttackTeamsMutation(c.config, OpUpdateOne, withEpicGvgAttackTeams(_m))
return &EpicGvgAttackTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicGvgAttackTeamsClient) UpdateOneID(id int64) *EpicGvgAttackTeamsUpdateOne {
mutation := newEpicGvgAttackTeamsMutation(c.config, OpUpdateOne, withEpicGvgAttackTeamsID(id))
return &EpicGvgAttackTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicGvgAttackTeams.
func (c *EpicGvgAttackTeamsClient) Delete() *EpicGvgAttackTeamsDelete {
mutation := newEpicGvgAttackTeamsMutation(c.config, OpDelete)
return &EpicGvgAttackTeamsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicGvgAttackTeamsClient) DeleteOne(_m *EpicGvgAttackTeams) *EpicGvgAttackTeamsDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicGvgAttackTeamsClient) DeleteOneID(id int64) *EpicGvgAttackTeamsDeleteOne {
builder := c.Delete().Where(epicgvgattackteams.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicGvgAttackTeamsDeleteOne{builder}
}
// Query returns a query builder for EpicGvgAttackTeams.
func (c *EpicGvgAttackTeamsClient) Query() *EpicGvgAttackTeamsQuery {
return &EpicGvgAttackTeamsQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicGvgAttackTeams},
inters: c.Interceptors(),
}
}
// Get returns a EpicGvgAttackTeams entity by its id.
func (c *EpicGvgAttackTeamsClient) Get(ctx context.Context, id int64) (*EpicGvgAttackTeams, error) {
return c.Query().Where(epicgvgattackteams.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicGvgAttackTeamsClient) GetX(ctx context.Context, id int64) *EpicGvgAttackTeams {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicGvgAttackTeamsClient) Hooks() []Hook {
return c.hooks.EpicGvgAttackTeams
}
// Interceptors returns the client interceptors.
func (c *EpicGvgAttackTeamsClient) Interceptors() []Interceptor {
return c.inters.EpicGvgAttackTeams
}
func (c *EpicGvgAttackTeamsClient) mutate(ctx context.Context, m *EpicGvgAttackTeamsMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicGvgAttackTeamsCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicGvgAttackTeamsUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicGvgAttackTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicGvgAttackTeamsDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicGvgAttackTeams mutation op: %q", m.Op())
}
}
// EpicGvgDefenseAttackMappingClient is a client for the EpicGvgDefenseAttackMapping schema.
type EpicGvgDefenseAttackMappingClient struct {
config
}
// NewEpicGvgDefenseAttackMappingClient returns a client for the EpicGvgDefenseAttackMapping from the given config.
func NewEpicGvgDefenseAttackMappingClient(c config) *EpicGvgDefenseAttackMappingClient {
return &EpicGvgDefenseAttackMappingClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicgvgdefenseattackmapping.Hooks(f(g(h())))`.
func (c *EpicGvgDefenseAttackMappingClient) Use(hooks ...Hook) {
c.hooks.EpicGvgDefenseAttackMapping = append(c.hooks.EpicGvgDefenseAttackMapping, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicgvgdefenseattackmapping.Intercept(f(g(h())))`.
func (c *EpicGvgDefenseAttackMappingClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicGvgDefenseAttackMapping = append(c.inters.EpicGvgDefenseAttackMapping, interceptors...)
}
// Create returns a builder for creating a EpicGvgDefenseAttackMapping entity.
func (c *EpicGvgDefenseAttackMappingClient) Create() *EpicGvgDefenseAttackMappingCreate {
mutation := newEpicGvgDefenseAttackMappingMutation(c.config, OpCreate)
return &EpicGvgDefenseAttackMappingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicGvgDefenseAttackMapping entities.
func (c *EpicGvgDefenseAttackMappingClient) CreateBulk(builders ...*EpicGvgDefenseAttackMappingCreate) *EpicGvgDefenseAttackMappingCreateBulk {
return &EpicGvgDefenseAttackMappingCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicGvgDefenseAttackMappingClient) MapCreateBulk(slice any, setFunc func(*EpicGvgDefenseAttackMappingCreate, int)) *EpicGvgDefenseAttackMappingCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicGvgDefenseAttackMappingCreateBulk{err: fmt.Errorf("calling to EpicGvgDefenseAttackMappingClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicGvgDefenseAttackMappingCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicGvgDefenseAttackMappingCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicGvgDefenseAttackMapping.
func (c *EpicGvgDefenseAttackMappingClient) Update() *EpicGvgDefenseAttackMappingUpdate {
mutation := newEpicGvgDefenseAttackMappingMutation(c.config, OpUpdate)
return &EpicGvgDefenseAttackMappingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicGvgDefenseAttackMappingClient) UpdateOne(_m *EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingUpdateOne {
mutation := newEpicGvgDefenseAttackMappingMutation(c.config, OpUpdateOne, withEpicGvgDefenseAttackMapping(_m))
return &EpicGvgDefenseAttackMappingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicGvgDefenseAttackMappingClient) UpdateOneID(id int64) *EpicGvgDefenseAttackMappingUpdateOne {
mutation := newEpicGvgDefenseAttackMappingMutation(c.config, OpUpdateOne, withEpicGvgDefenseAttackMappingID(id))
return &EpicGvgDefenseAttackMappingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicGvgDefenseAttackMapping.
func (c *EpicGvgDefenseAttackMappingClient) Delete() *EpicGvgDefenseAttackMappingDelete {
mutation := newEpicGvgDefenseAttackMappingMutation(c.config, OpDelete)
return &EpicGvgDefenseAttackMappingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicGvgDefenseAttackMappingClient) DeleteOne(_m *EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicGvgDefenseAttackMappingClient) DeleteOneID(id int64) *EpicGvgDefenseAttackMappingDeleteOne {
builder := c.Delete().Where(epicgvgdefenseattackmapping.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicGvgDefenseAttackMappingDeleteOne{builder}
}
// Query returns a query builder for EpicGvgDefenseAttackMapping.
func (c *EpicGvgDefenseAttackMappingClient) Query() *EpicGvgDefenseAttackMappingQuery {
return &EpicGvgDefenseAttackMappingQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicGvgDefenseAttackMapping},
inters: c.Interceptors(),
}
}
// Get returns a EpicGvgDefenseAttackMapping entity by its id.
func (c *EpicGvgDefenseAttackMappingClient) Get(ctx context.Context, id int64) (*EpicGvgDefenseAttackMapping, error) {
return c.Query().Where(epicgvgdefenseattackmapping.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicGvgDefenseAttackMappingClient) GetX(ctx context.Context, id int64) *EpicGvgDefenseAttackMapping {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicGvgDefenseAttackMappingClient) Hooks() []Hook {
return c.hooks.EpicGvgDefenseAttackMapping
}
// Interceptors returns the client interceptors.
func (c *EpicGvgDefenseAttackMappingClient) Interceptors() []Interceptor {
return c.inters.EpicGvgDefenseAttackMapping
}
func (c *EpicGvgDefenseAttackMappingClient) mutate(ctx context.Context, m *EpicGvgDefenseAttackMappingMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicGvgDefenseAttackMappingCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicGvgDefenseAttackMappingUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicGvgDefenseAttackMappingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicGvgDefenseAttackMappingDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicGvgDefenseAttackMapping mutation op: %q", m.Op())
}
}
// EpicGvgDefenseTeamsClient is a client for the EpicGvgDefenseTeams schema.
type EpicGvgDefenseTeamsClient struct {
config
}
// NewEpicGvgDefenseTeamsClient returns a client for the EpicGvgDefenseTeams from the given config.
func NewEpicGvgDefenseTeamsClient(c config) *EpicGvgDefenseTeamsClient {
return &EpicGvgDefenseTeamsClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicgvgdefenseteams.Hooks(f(g(h())))`.
func (c *EpicGvgDefenseTeamsClient) Use(hooks ...Hook) {
c.hooks.EpicGvgDefenseTeams = append(c.hooks.EpicGvgDefenseTeams, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicgvgdefenseteams.Intercept(f(g(h())))`.
func (c *EpicGvgDefenseTeamsClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicGvgDefenseTeams = append(c.inters.EpicGvgDefenseTeams, interceptors...)
}
// Create returns a builder for creating a EpicGvgDefenseTeams entity.
func (c *EpicGvgDefenseTeamsClient) Create() *EpicGvgDefenseTeamsCreate {
mutation := newEpicGvgDefenseTeamsMutation(c.config, OpCreate)
return &EpicGvgDefenseTeamsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicGvgDefenseTeams entities.
func (c *EpicGvgDefenseTeamsClient) CreateBulk(builders ...*EpicGvgDefenseTeamsCreate) *EpicGvgDefenseTeamsCreateBulk {
return &EpicGvgDefenseTeamsCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicGvgDefenseTeamsClient) MapCreateBulk(slice any, setFunc func(*EpicGvgDefenseTeamsCreate, int)) *EpicGvgDefenseTeamsCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicGvgDefenseTeamsCreateBulk{err: fmt.Errorf("calling to EpicGvgDefenseTeamsClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicGvgDefenseTeamsCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicGvgDefenseTeamsCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicGvgDefenseTeams.
func (c *EpicGvgDefenseTeamsClient) Update() *EpicGvgDefenseTeamsUpdate {
mutation := newEpicGvgDefenseTeamsMutation(c.config, OpUpdate)
return &EpicGvgDefenseTeamsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicGvgDefenseTeamsClient) UpdateOne(_m *EpicGvgDefenseTeams) *EpicGvgDefenseTeamsUpdateOne {
mutation := newEpicGvgDefenseTeamsMutation(c.config, OpUpdateOne, withEpicGvgDefenseTeams(_m))
return &EpicGvgDefenseTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicGvgDefenseTeamsClient) UpdateOneID(id int64) *EpicGvgDefenseTeamsUpdateOne {
mutation := newEpicGvgDefenseTeamsMutation(c.config, OpUpdateOne, withEpicGvgDefenseTeamsID(id))
return &EpicGvgDefenseTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicGvgDefenseTeams.
func (c *EpicGvgDefenseTeamsClient) Delete() *EpicGvgDefenseTeamsDelete {
mutation := newEpicGvgDefenseTeamsMutation(c.config, OpDelete)
return &EpicGvgDefenseTeamsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicGvgDefenseTeamsClient) DeleteOne(_m *EpicGvgDefenseTeams) *EpicGvgDefenseTeamsDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicGvgDefenseTeamsClient) DeleteOneID(id int64) *EpicGvgDefenseTeamsDeleteOne {
builder := c.Delete().Where(epicgvgdefenseteams.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicGvgDefenseTeamsDeleteOne{builder}
}
// Query returns a query builder for EpicGvgDefenseTeams.
func (c *EpicGvgDefenseTeamsClient) Query() *EpicGvgDefenseTeamsQuery {
return &EpicGvgDefenseTeamsQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicGvgDefenseTeams},
inters: c.Interceptors(),
}
}
// Get returns a EpicGvgDefenseTeams entity by its id.
func (c *EpicGvgDefenseTeamsClient) Get(ctx context.Context, id int64) (*EpicGvgDefenseTeams, error) {
return c.Query().Where(epicgvgdefenseteams.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicGvgDefenseTeamsClient) GetX(ctx context.Context, id int64) *EpicGvgDefenseTeams {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicGvgDefenseTeamsClient) Hooks() []Hook {
return c.hooks.EpicGvgDefenseTeams
}
// Interceptors returns the client interceptors.
func (c *EpicGvgDefenseTeamsClient) Interceptors() []Interceptor {
return c.inters.EpicGvgDefenseTeams
}
func (c *EpicGvgDefenseTeamsClient) mutate(ctx context.Context, m *EpicGvgDefenseTeamsMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicGvgDefenseTeamsCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicGvgDefenseTeamsUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicGvgDefenseTeamsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicGvgDefenseTeamsDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicGvgDefenseTeams mutation op: %q", m.Op())
}
}
// EpicHeroInfoClient is a client for the EpicHeroInfo schema.
type EpicHeroInfoClient struct {
config
}
// NewEpicHeroInfoClient returns a client for the EpicHeroInfo from the given config.
func NewEpicHeroInfoClient(c config) *EpicHeroInfoClient {
return &EpicHeroInfoClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicheroinfo.Hooks(f(g(h())))`.
func (c *EpicHeroInfoClient) Use(hooks ...Hook) {
c.hooks.EpicHeroInfo = append(c.hooks.EpicHeroInfo, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicheroinfo.Intercept(f(g(h())))`.
func (c *EpicHeroInfoClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicHeroInfo = append(c.inters.EpicHeroInfo, interceptors...)
}
// Create returns a builder for creating a EpicHeroInfo entity.
func (c *EpicHeroInfoClient) Create() *EpicHeroInfoCreate {
mutation := newEpicHeroInfoMutation(c.config, OpCreate)
return &EpicHeroInfoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicHeroInfo entities.
func (c *EpicHeroInfoClient) CreateBulk(builders ...*EpicHeroInfoCreate) *EpicHeroInfoCreateBulk {
return &EpicHeroInfoCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicHeroInfoClient) MapCreateBulk(slice any, setFunc func(*EpicHeroInfoCreate, int)) *EpicHeroInfoCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicHeroInfoCreateBulk{err: fmt.Errorf("calling to EpicHeroInfoClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicHeroInfoCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicHeroInfoCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicHeroInfo.
func (c *EpicHeroInfoClient) Update() *EpicHeroInfoUpdate {
mutation := newEpicHeroInfoMutation(c.config, OpUpdate)
return &EpicHeroInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicHeroInfoClient) UpdateOne(_m *EpicHeroInfo) *EpicHeroInfoUpdateOne {
mutation := newEpicHeroInfoMutation(c.config, OpUpdateOne, withEpicHeroInfo(_m))
return &EpicHeroInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicHeroInfoClient) UpdateOneID(id int64) *EpicHeroInfoUpdateOne {
mutation := newEpicHeroInfoMutation(c.config, OpUpdateOne, withEpicHeroInfoID(id))
return &EpicHeroInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicHeroInfo.
func (c *EpicHeroInfoClient) Delete() *EpicHeroInfoDelete {
mutation := newEpicHeroInfoMutation(c.config, OpDelete)
return &EpicHeroInfoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicHeroInfoClient) DeleteOne(_m *EpicHeroInfo) *EpicHeroInfoDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicHeroInfoClient) DeleteOneID(id int64) *EpicHeroInfoDeleteOne {
builder := c.Delete().Where(epicheroinfo.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicHeroInfoDeleteOne{builder}
}
// Query returns a query builder for EpicHeroInfo.
func (c *EpicHeroInfoClient) Query() *EpicHeroInfoQuery {
return &EpicHeroInfoQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicHeroInfo},
inters: c.Interceptors(),
}
}
// Get returns a EpicHeroInfo entity by its id.
func (c *EpicHeroInfoClient) Get(ctx context.Context, id int64) (*EpicHeroInfo, error) {
return c.Query().Where(epicheroinfo.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicHeroInfoClient) GetX(ctx context.Context, id int64) *EpicHeroInfo {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicHeroInfoClient) Hooks() []Hook {
return c.hooks.EpicHeroInfo
}
// Interceptors returns the client interceptors.
func (c *EpicHeroInfoClient) Interceptors() []Interceptor {
return c.inters.EpicHeroInfo
}
func (c *EpicHeroInfoClient) mutate(ctx context.Context, m *EpicHeroInfoMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicHeroInfoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicHeroInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicHeroInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicHeroInfoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicHeroInfo mutation op: %q", m.Op())
}
}
// EpicHeroUserBuildClient is a client for the EpicHeroUserBuild schema.
type EpicHeroUserBuildClient struct {
config
}
// NewEpicHeroUserBuildClient returns a client for the EpicHeroUserBuild from the given config.
func NewEpicHeroUserBuildClient(c config) *EpicHeroUserBuildClient {
return &EpicHeroUserBuildClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epicherouserbuild.Hooks(f(g(h())))`.
func (c *EpicHeroUserBuildClient) Use(hooks ...Hook) {
c.hooks.EpicHeroUserBuild = append(c.hooks.EpicHeroUserBuild, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epicherouserbuild.Intercept(f(g(h())))`.
func (c *EpicHeroUserBuildClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicHeroUserBuild = append(c.inters.EpicHeroUserBuild, interceptors...)
}
// Create returns a builder for creating a EpicHeroUserBuild entity.
func (c *EpicHeroUserBuildClient) Create() *EpicHeroUserBuildCreate {
mutation := newEpicHeroUserBuildMutation(c.config, OpCreate)
return &EpicHeroUserBuildCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicHeroUserBuild entities.
func (c *EpicHeroUserBuildClient) CreateBulk(builders ...*EpicHeroUserBuildCreate) *EpicHeroUserBuildCreateBulk {
return &EpicHeroUserBuildCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicHeroUserBuildClient) MapCreateBulk(slice any, setFunc func(*EpicHeroUserBuildCreate, int)) *EpicHeroUserBuildCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicHeroUserBuildCreateBulk{err: fmt.Errorf("calling to EpicHeroUserBuildClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicHeroUserBuildCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicHeroUserBuildCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicHeroUserBuild.
func (c *EpicHeroUserBuildClient) Update() *EpicHeroUserBuildUpdate {
mutation := newEpicHeroUserBuildMutation(c.config, OpUpdate)
return &EpicHeroUserBuildUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicHeroUserBuildClient) UpdateOne(_m *EpicHeroUserBuild) *EpicHeroUserBuildUpdateOne {
mutation := newEpicHeroUserBuildMutation(c.config, OpUpdateOne, withEpicHeroUserBuild(_m))
return &EpicHeroUserBuildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicHeroUserBuildClient) UpdateOneID(id int64) *EpicHeroUserBuildUpdateOne {
mutation := newEpicHeroUserBuildMutation(c.config, OpUpdateOne, withEpicHeroUserBuildID(id))
return &EpicHeroUserBuildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicHeroUserBuild.
func (c *EpicHeroUserBuildClient) Delete() *EpicHeroUserBuildDelete {
mutation := newEpicHeroUserBuildMutation(c.config, OpDelete)
return &EpicHeroUserBuildDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicHeroUserBuildClient) DeleteOne(_m *EpicHeroUserBuild) *EpicHeroUserBuildDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicHeroUserBuildClient) DeleteOneID(id int64) *EpicHeroUserBuildDeleteOne {
builder := c.Delete().Where(epicherouserbuild.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicHeroUserBuildDeleteOne{builder}
}
// Query returns a query builder for EpicHeroUserBuild.
func (c *EpicHeroUserBuildClient) Query() *EpicHeroUserBuildQuery {
return &EpicHeroUserBuildQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicHeroUserBuild},
inters: c.Interceptors(),
}
}
// Get returns a EpicHeroUserBuild entity by its id.
func (c *EpicHeroUserBuildClient) Get(ctx context.Context, id int64) (*EpicHeroUserBuild, error) {
return c.Query().Where(epicherouserbuild.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicHeroUserBuildClient) GetX(ctx context.Context, id int64) *EpicHeroUserBuild {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicHeroUserBuildClient) Hooks() []Hook {
return c.hooks.EpicHeroUserBuild
}
// Interceptors returns the client interceptors.
func (c *EpicHeroUserBuildClient) Interceptors() []Interceptor {
return c.inters.EpicHeroUserBuild
}
func (c *EpicHeroUserBuildClient) mutate(ctx context.Context, m *EpicHeroUserBuildMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicHeroUserBuildCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicHeroUserBuildUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicHeroUserBuildUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicHeroUserBuildDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicHeroUserBuild mutation op: %q", m.Op())
}
}
// EpicI18NMappingsClient is a client for the EpicI18NMappings schema.
type EpicI18NMappingsClient struct {
config
}
// NewEpicI18NMappingsClient returns a client for the EpicI18NMappings from the given config.
func NewEpicI18NMappingsClient(c config) *EpicI18NMappingsClient {
return &EpicI18NMappingsClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `epici18nmappings.Hooks(f(g(h())))`.
func (c *EpicI18NMappingsClient) Use(hooks ...Hook) {
c.hooks.EpicI18NMappings = append(c.hooks.EpicI18NMappings, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `epici18nmappings.Intercept(f(g(h())))`.
func (c *EpicI18NMappingsClient) Intercept(interceptors ...Interceptor) {
c.inters.EpicI18NMappings = append(c.inters.EpicI18NMappings, interceptors...)
}
// Create returns a builder for creating a EpicI18NMappings entity.
func (c *EpicI18NMappingsClient) Create() *EpicI18NMappingsCreate {
mutation := newEpicI18NMappingsMutation(c.config, OpCreate)
return &EpicI18NMappingsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of EpicI18NMappings entities.
func (c *EpicI18NMappingsClient) CreateBulk(builders ...*EpicI18NMappingsCreate) *EpicI18NMappingsCreateBulk {
return &EpicI18NMappingsCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *EpicI18NMappingsClient) MapCreateBulk(slice any, setFunc func(*EpicI18NMappingsCreate, int)) *EpicI18NMappingsCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &EpicI18NMappingsCreateBulk{err: fmt.Errorf("calling to EpicI18NMappingsClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*EpicI18NMappingsCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &EpicI18NMappingsCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for EpicI18NMappings.
func (c *EpicI18NMappingsClient) Update() *EpicI18NMappingsUpdate {
mutation := newEpicI18NMappingsMutation(c.config, OpUpdate)
return &EpicI18NMappingsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *EpicI18NMappingsClient) UpdateOne(_m *EpicI18NMappings) *EpicI18NMappingsUpdateOne {
mutation := newEpicI18NMappingsMutation(c.config, OpUpdateOne, withEpicI18NMappings(_m))
return &EpicI18NMappingsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *EpicI18NMappingsClient) UpdateOneID(id int64) *EpicI18NMappingsUpdateOne {
mutation := newEpicI18NMappingsMutation(c.config, OpUpdateOne, withEpicI18NMappingsID(id))
return &EpicI18NMappingsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for EpicI18NMappings.
func (c *EpicI18NMappingsClient) Delete() *EpicI18NMappingsDelete {
mutation := newEpicI18NMappingsMutation(c.config, OpDelete)
return &EpicI18NMappingsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *EpicI18NMappingsClient) DeleteOne(_m *EpicI18NMappings) *EpicI18NMappingsDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *EpicI18NMappingsClient) DeleteOneID(id int64) *EpicI18NMappingsDeleteOne {
builder := c.Delete().Where(epici18nmappings.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &EpicI18NMappingsDeleteOne{builder}
}
// Query returns a query builder for EpicI18NMappings.
func (c *EpicI18NMappingsClient) Query() *EpicI18NMappingsQuery {
return &EpicI18NMappingsQuery{
config: c.config,
ctx: &QueryContext{Type: TypeEpicI18NMappings},
inters: c.Interceptors(),
}
}
// Get returns a EpicI18NMappings entity by its id.
func (c *EpicI18NMappingsClient) Get(ctx context.Context, id int64) (*EpicI18NMappings, error) {
return c.Query().Where(epici18nmappings.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *EpicI18NMappingsClient) GetX(ctx context.Context, id int64) *EpicI18NMappings {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *EpicI18NMappingsClient) Hooks() []Hook {
return c.hooks.EpicI18NMappings
}
// Interceptors returns the client interceptors.
func (c *EpicI18NMappingsClient) Interceptors() []Interceptor {
return c.inters.EpicI18NMappings
}
func (c *EpicI18NMappingsClient) mutate(ctx context.Context, m *EpicI18NMappingsMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&EpicI18NMappingsCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&EpicI18NMappingsUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&EpicI18NMappingsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&EpicI18NMappingsDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown EpicI18NMappings mutation op: %q", m.Op())
}
}
// FribbleHeroSetClient is a client for the FribbleHeroSet schema.
type FribbleHeroSetClient struct {
config
}
// NewFribbleHeroSetClient returns a client for the FribbleHeroSet from the given config.
func NewFribbleHeroSetClient(c config) *FribbleHeroSetClient {
return &FribbleHeroSetClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `fribbleheroset.Hooks(f(g(h())))`.
func (c *FribbleHeroSetClient) Use(hooks ...Hook) {
c.hooks.FribbleHeroSet = append(c.hooks.FribbleHeroSet, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `fribbleheroset.Intercept(f(g(h())))`.
func (c *FribbleHeroSetClient) Intercept(interceptors ...Interceptor) {
c.inters.FribbleHeroSet = append(c.inters.FribbleHeroSet, interceptors...)
}
// Create returns a builder for creating a FribbleHeroSet entity.
func (c *FribbleHeroSetClient) Create() *FribbleHeroSetCreate {
mutation := newFribbleHeroSetMutation(c.config, OpCreate)
return &FribbleHeroSetCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of FribbleHeroSet entities.
func (c *FribbleHeroSetClient) CreateBulk(builders ...*FribbleHeroSetCreate) *FribbleHeroSetCreateBulk {
return &FribbleHeroSetCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *FribbleHeroSetClient) MapCreateBulk(slice any, setFunc func(*FribbleHeroSetCreate, int)) *FribbleHeroSetCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &FribbleHeroSetCreateBulk{err: fmt.Errorf("calling to FribbleHeroSetClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*FribbleHeroSetCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &FribbleHeroSetCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for FribbleHeroSet.
func (c *FribbleHeroSetClient) Update() *FribbleHeroSetUpdate {
mutation := newFribbleHeroSetMutation(c.config, OpUpdate)
return &FribbleHeroSetUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *FribbleHeroSetClient) UpdateOne(_m *FribbleHeroSet) *FribbleHeroSetUpdateOne {
mutation := newFribbleHeroSetMutation(c.config, OpUpdateOne, withFribbleHeroSet(_m))
return &FribbleHeroSetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *FribbleHeroSetClient) UpdateOneID(id int64) *FribbleHeroSetUpdateOne {
mutation := newFribbleHeroSetMutation(c.config, OpUpdateOne, withFribbleHeroSetID(id))
return &FribbleHeroSetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for FribbleHeroSet.
func (c *FribbleHeroSetClient) Delete() *FribbleHeroSetDelete {
mutation := newFribbleHeroSetMutation(c.config, OpDelete)
return &FribbleHeroSetDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *FribbleHeroSetClient) DeleteOne(_m *FribbleHeroSet) *FribbleHeroSetDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *FribbleHeroSetClient) DeleteOneID(id int64) *FribbleHeroSetDeleteOne {
builder := c.Delete().Where(fribbleheroset.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &FribbleHeroSetDeleteOne{builder}
}
// Query returns a query builder for FribbleHeroSet.
func (c *FribbleHeroSetClient) Query() *FribbleHeroSetQuery {
return &FribbleHeroSetQuery{
config: c.config,
ctx: &QueryContext{Type: TypeFribbleHeroSet},
inters: c.Interceptors(),
}
}
// Get returns a FribbleHeroSet entity by its id.
func (c *FribbleHeroSetClient) Get(ctx context.Context, id int64) (*FribbleHeroSet, error) {
return c.Query().Where(fribbleheroset.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *FribbleHeroSetClient) GetX(ctx context.Context, id int64) *FribbleHeroSet {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *FribbleHeroSetClient) Hooks() []Hook {
return c.hooks.FribbleHeroSet
}
// Interceptors returns the client interceptors.
func (c *FribbleHeroSetClient) Interceptors() []Interceptor {
return c.inters.FribbleHeroSet
}
func (c *FribbleHeroSetClient) mutate(ctx context.Context, m *FribbleHeroSetMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&FribbleHeroSetCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&FribbleHeroSetUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&FribbleHeroSetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&FribbleHeroSetDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown FribbleHeroSet mutation op: %q", m.Op())
}
}
// GearSetInfoClient is a client for the GearSetInfo schema.
type GearSetInfoClient struct {
config
}
// NewGearSetInfoClient returns a client for the GearSetInfo from the given config.
func NewGearSetInfoClient(c config) *GearSetInfoClient {
return &GearSetInfoClient{config: c}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `gearsetinfo.Hooks(f(g(h())))`.
func (c *GearSetInfoClient) Use(hooks ...Hook) {
c.hooks.GearSetInfo = append(c.hooks.GearSetInfo, hooks...)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `gearsetinfo.Intercept(f(g(h())))`.
func (c *GearSetInfoClient) Intercept(interceptors ...Interceptor) {
c.inters.GearSetInfo = append(c.inters.GearSetInfo, interceptors...)
}
// Create returns a builder for creating a GearSetInfo entity.
func (c *GearSetInfoClient) Create() *GearSetInfoCreate {
mutation := newGearSetInfoMutation(c.config, OpCreate)
return &GearSetInfoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// CreateBulk returns a builder for creating a bulk of GearSetInfo entities.
func (c *GearSetInfoClient) CreateBulk(builders ...*GearSetInfoCreate) *GearSetInfoCreateBulk {
return &GearSetInfoCreateBulk{config: c.config, builders: builders}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func (c *GearSetInfoClient) MapCreateBulk(slice any, setFunc func(*GearSetInfoCreate, int)) *GearSetInfoCreateBulk {
rv := reflect.ValueOf(slice)
if rv.Kind() != reflect.Slice {
return &GearSetInfoCreateBulk{err: fmt.Errorf("calling to GearSetInfoClient.MapCreateBulk with wrong type %T, need slice", slice)}
}
builders := make([]*GearSetInfoCreate, rv.Len())
for i := 0; i < rv.Len(); i++ {
builders[i] = c.Create()
setFunc(builders[i], i)
}
return &GearSetInfoCreateBulk{config: c.config, builders: builders}
}
// Update returns an update builder for GearSetInfo.
func (c *GearSetInfoClient) Update() *GearSetInfoUpdate {
mutation := newGearSetInfoMutation(c.config, OpUpdate)
return &GearSetInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOne returns an update builder for the given entity.
func (c *GearSetInfoClient) UpdateOne(_m *GearSetInfo) *GearSetInfoUpdateOne {
mutation := newGearSetInfoMutation(c.config, OpUpdateOne, withGearSetInfo(_m))
return &GearSetInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// UpdateOneID returns an update builder for the given id.
func (c *GearSetInfoClient) UpdateOneID(id int64) *GearSetInfoUpdateOne {
mutation := newGearSetInfoMutation(c.config, OpUpdateOne, withGearSetInfoID(id))
return &GearSetInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// Delete returns a delete builder for GearSetInfo.
func (c *GearSetInfoClient) Delete() *GearSetInfoDelete {
mutation := newGearSetInfoMutation(c.config, OpDelete)
return &GearSetInfoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a builder for deleting the given entity.
func (c *GearSetInfoClient) DeleteOne(_m *GearSetInfo) *GearSetInfoDeleteOne {
return c.DeleteOneID(_m.ID)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func (c *GearSetInfoClient) DeleteOneID(id int64) *GearSetInfoDeleteOne {
builder := c.Delete().Where(gearsetinfo.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &GearSetInfoDeleteOne{builder}
}
// Query returns a query builder for GearSetInfo.
func (c *GearSetInfoClient) Query() *GearSetInfoQuery {
return &GearSetInfoQuery{
config: c.config,
ctx: &QueryContext{Type: TypeGearSetInfo},
inters: c.Interceptors(),
}
}
// Get returns a GearSetInfo entity by its id.
func (c *GearSetInfoClient) Get(ctx context.Context, id int64) (*GearSetInfo, error) {
return c.Query().Where(gearsetinfo.ID(id)).Only(ctx)
}
// GetX is like Get, but panics if an error occurs.
func (c *GearSetInfoClient) GetX(ctx context.Context, id int64) *GearSetInfo {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
}
// Hooks returns the client hooks.
func (c *GearSetInfoClient) Hooks() []Hook {
return c.hooks.GearSetInfo
}
// Interceptors returns the client interceptors.
func (c *GearSetInfoClient) Interceptors() []Interceptor {
return c.inters.GearSetInfo
}
func (c *GearSetInfoClient) mutate(ctx context.Context, m *GearSetInfoMutation) (Value, error) {
switch m.Op() {
case OpCreate:
return (&GearSetInfoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdate:
return (&GearSetInfoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpUpdateOne:
return (&GearSetInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
case OpDelete, OpDeleteOne:
return (&GearSetInfoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
default:
return nil, fmt.Errorf("ent: unknown GearSetInfo mutation op: %q", m.Op())
}
}
// hooks and interceptors per client, for fast access.
type (
hooks struct {
EpicArtifactInfo, EpicGvgAttackTeams, EpicGvgDefenseAttackMapping,
EpicGvgDefenseTeams, EpicHeroInfo, EpicHeroUserBuild, EpicI18NMappings,
FribbleHeroSet, GearSetInfo []ent.Hook
}
inters struct {
EpicArtifactInfo, EpicGvgAttackTeams, EpicGvgDefenseAttackMapping,
EpicGvgDefenseTeams, EpicHeroInfo, EpicHeroUserBuild, EpicI18NMappings,
FribbleHeroSet, GearSetInfo []ent.Interceptor
}
)