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

9445 lines
301 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"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"
"epic-ent/internal/ent/predicate"
"errors"
"fmt"
"sync"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
const (
// Operation types.
OpCreate = ent.OpCreate
OpDelete = ent.OpDelete
OpDeleteOne = ent.OpDeleteOne
OpUpdate = ent.OpUpdate
OpUpdateOne = ent.OpUpdateOne
// Node types.
TypeEpicArtifactInfo = "EpicArtifactInfo"
TypeEpicGvgAttackTeams = "EpicGvgAttackTeams"
TypeEpicGvgDefenseAttackMapping = "EpicGvgDefenseAttackMapping"
TypeEpicGvgDefenseTeams = "EpicGvgDefenseTeams"
TypeEpicHeroInfo = "EpicHeroInfo"
TypeEpicHeroUserBuild = "EpicHeroUserBuild"
TypeEpicI18NMappings = "EpicI18NMappings"
TypeFribbleHeroSet = "FribbleHeroSet"
TypeGearSetInfo = "GearSetInfo"
)
// EpicArtifactInfoMutation represents an operation that mutates the EpicArtifactInfo nodes in the graph.
type EpicArtifactInfoMutation struct {
config
op Op
typ string
id *int64
artifact_name *string
artifact_code *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
stats_health *int
addstats_health *int
stats_attack *int
addstats_attack *int
stats_defense *int
addstats_defense *int
rarity *string
role *string
artifact_name_en *string
image_url *string
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicArtifactInfo, error)
predicates []predicate.EpicArtifactInfo
}
var _ ent.Mutation = (*EpicArtifactInfoMutation)(nil)
// epicartifactinfoOption allows management of the mutation configuration using functional options.
type epicartifactinfoOption func(*EpicArtifactInfoMutation)
// newEpicArtifactInfoMutation creates new mutation for the EpicArtifactInfo entity.
func newEpicArtifactInfoMutation(c config, op Op, opts ...epicartifactinfoOption) *EpicArtifactInfoMutation {
m := &EpicArtifactInfoMutation{
config: c,
op: op,
typ: TypeEpicArtifactInfo,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicArtifactInfoID sets the ID field of the mutation.
func withEpicArtifactInfoID(id int64) epicartifactinfoOption {
return func(m *EpicArtifactInfoMutation) {
var (
err error
once sync.Once
value *EpicArtifactInfo
)
m.oldValue = func(ctx context.Context) (*EpicArtifactInfo, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicArtifactInfo.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicArtifactInfo sets the old EpicArtifactInfo of the mutation.
func withEpicArtifactInfo(node *EpicArtifactInfo) epicartifactinfoOption {
return func(m *EpicArtifactInfoMutation) {
m.oldValue = func(context.Context) (*EpicArtifactInfo, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicArtifactInfoMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicArtifactInfoMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicArtifactInfo entities.
func (m *EpicArtifactInfoMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicArtifactInfoMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicArtifactInfoMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicArtifactInfo.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetArtifactName sets the "artifact_name" field.
func (m *EpicArtifactInfoMutation) SetArtifactName(s string) {
m.artifact_name = &s
}
// ArtifactName returns the value of the "artifact_name" field in the mutation.
func (m *EpicArtifactInfoMutation) ArtifactName() (r string, exists bool) {
v := m.artifact_name
if v == nil {
return
}
return *v, true
}
// OldArtifactName returns the old "artifact_name" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldArtifactName(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldArtifactName is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldArtifactName requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldArtifactName: %w", err)
}
return oldValue.ArtifactName, nil
}
// ResetArtifactName resets all changes to the "artifact_name" field.
func (m *EpicArtifactInfoMutation) ResetArtifactName() {
m.artifact_name = nil
}
// SetArtifactCode sets the "artifact_code" field.
func (m *EpicArtifactInfoMutation) SetArtifactCode(s string) {
m.artifact_code = &s
}
// ArtifactCode returns the value of the "artifact_code" field in the mutation.
func (m *EpicArtifactInfoMutation) ArtifactCode() (r string, exists bool) {
v := m.artifact_code
if v == nil {
return
}
return *v, true
}
// OldArtifactCode returns the old "artifact_code" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldArtifactCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldArtifactCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldArtifactCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldArtifactCode: %w", err)
}
return oldValue.ArtifactCode, nil
}
// ResetArtifactCode resets all changes to the "artifact_code" field.
func (m *EpicArtifactInfoMutation) ResetArtifactCode() {
m.artifact_code = nil
}
// SetCreator sets the "creator" field.
func (m *EpicArtifactInfoMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicArtifactInfoMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicArtifactInfoMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicArtifactInfoMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicArtifactInfoMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicArtifactInfoMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicartifactinfo.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicArtifactInfoMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicartifactinfo.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicArtifactInfoMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicartifactinfo.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicArtifactInfoMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicArtifactInfoMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicArtifactInfoMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicArtifactInfoMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicArtifactInfoMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicArtifactInfoMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicartifactinfo.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicArtifactInfoMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicartifactinfo.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicArtifactInfoMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicartifactinfo.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicArtifactInfoMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicArtifactInfoMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicArtifactInfoMutation) ResetDeleted() {
m.deleted = nil
}
// SetStatsHealth sets the "stats_health" field.
func (m *EpicArtifactInfoMutation) SetStatsHealth(i int) {
m.stats_health = &i
m.addstats_health = nil
}
// StatsHealth returns the value of the "stats_health" field in the mutation.
func (m *EpicArtifactInfoMutation) StatsHealth() (r int, exists bool) {
v := m.stats_health
if v == nil {
return
}
return *v, true
}
// OldStatsHealth returns the old "stats_health" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldStatsHealth(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldStatsHealth is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldStatsHealth requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldStatsHealth: %w", err)
}
return oldValue.StatsHealth, nil
}
// AddStatsHealth adds i to the "stats_health" field.
func (m *EpicArtifactInfoMutation) AddStatsHealth(i int) {
if m.addstats_health != nil {
*m.addstats_health += i
} else {
m.addstats_health = &i
}
}
// AddedStatsHealth returns the value that was added to the "stats_health" field in this mutation.
func (m *EpicArtifactInfoMutation) AddedStatsHealth() (r int, exists bool) {
v := m.addstats_health
if v == nil {
return
}
return *v, true
}
// ResetStatsHealth resets all changes to the "stats_health" field.
func (m *EpicArtifactInfoMutation) ResetStatsHealth() {
m.stats_health = nil
m.addstats_health = nil
}
// SetStatsAttack sets the "stats_attack" field.
func (m *EpicArtifactInfoMutation) SetStatsAttack(i int) {
m.stats_attack = &i
m.addstats_attack = nil
}
// StatsAttack returns the value of the "stats_attack" field in the mutation.
func (m *EpicArtifactInfoMutation) StatsAttack() (r int, exists bool) {
v := m.stats_attack
if v == nil {
return
}
return *v, true
}
// OldStatsAttack returns the old "stats_attack" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldStatsAttack(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldStatsAttack is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldStatsAttack requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldStatsAttack: %w", err)
}
return oldValue.StatsAttack, nil
}
// AddStatsAttack adds i to the "stats_attack" field.
func (m *EpicArtifactInfoMutation) AddStatsAttack(i int) {
if m.addstats_attack != nil {
*m.addstats_attack += i
} else {
m.addstats_attack = &i
}
}
// AddedStatsAttack returns the value that was added to the "stats_attack" field in this mutation.
func (m *EpicArtifactInfoMutation) AddedStatsAttack() (r int, exists bool) {
v := m.addstats_attack
if v == nil {
return
}
return *v, true
}
// ResetStatsAttack resets all changes to the "stats_attack" field.
func (m *EpicArtifactInfoMutation) ResetStatsAttack() {
m.stats_attack = nil
m.addstats_attack = nil
}
// SetStatsDefense sets the "stats_defense" field.
func (m *EpicArtifactInfoMutation) SetStatsDefense(i int) {
m.stats_defense = &i
m.addstats_defense = nil
}
// StatsDefense returns the value of the "stats_defense" field in the mutation.
func (m *EpicArtifactInfoMutation) StatsDefense() (r int, exists bool) {
v := m.stats_defense
if v == nil {
return
}
return *v, true
}
// OldStatsDefense returns the old "stats_defense" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldStatsDefense(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldStatsDefense is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldStatsDefense requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldStatsDefense: %w", err)
}
return oldValue.StatsDefense, nil
}
// AddStatsDefense adds i to the "stats_defense" field.
func (m *EpicArtifactInfoMutation) AddStatsDefense(i int) {
if m.addstats_defense != nil {
*m.addstats_defense += i
} else {
m.addstats_defense = &i
}
}
// AddedStatsDefense returns the value that was added to the "stats_defense" field in this mutation.
func (m *EpicArtifactInfoMutation) AddedStatsDefense() (r int, exists bool) {
v := m.addstats_defense
if v == nil {
return
}
return *v, true
}
// ResetStatsDefense resets all changes to the "stats_defense" field.
func (m *EpicArtifactInfoMutation) ResetStatsDefense() {
m.stats_defense = nil
m.addstats_defense = nil
}
// SetRarity sets the "rarity" field.
func (m *EpicArtifactInfoMutation) SetRarity(s string) {
m.rarity = &s
}
// Rarity returns the value of the "rarity" field in the mutation.
func (m *EpicArtifactInfoMutation) Rarity() (r string, exists bool) {
v := m.rarity
if v == nil {
return
}
return *v, true
}
// OldRarity returns the old "rarity" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldRarity(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRarity is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRarity requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRarity: %w", err)
}
return oldValue.Rarity, nil
}
// ResetRarity resets all changes to the "rarity" field.
func (m *EpicArtifactInfoMutation) ResetRarity() {
m.rarity = nil
}
// SetRole sets the "role" field.
func (m *EpicArtifactInfoMutation) SetRole(s string) {
m.role = &s
}
// Role returns the value of the "role" field in the mutation.
func (m *EpicArtifactInfoMutation) Role() (r string, exists bool) {
v := m.role
if v == nil {
return
}
return *v, true
}
// OldRole returns the old "role" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldRole(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRole is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRole requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRole: %w", err)
}
return oldValue.Role, nil
}
// ResetRole resets all changes to the "role" field.
func (m *EpicArtifactInfoMutation) ResetRole() {
m.role = nil
}
// SetArtifactNameEn sets the "artifact_name_en" field.
func (m *EpicArtifactInfoMutation) SetArtifactNameEn(s string) {
m.artifact_name_en = &s
}
// ArtifactNameEn returns the value of the "artifact_name_en" field in the mutation.
func (m *EpicArtifactInfoMutation) ArtifactNameEn() (r string, exists bool) {
v := m.artifact_name_en
if v == nil {
return
}
return *v, true
}
// OldArtifactNameEn returns the old "artifact_name_en" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldArtifactNameEn(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldArtifactNameEn is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldArtifactNameEn requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldArtifactNameEn: %w", err)
}
return oldValue.ArtifactNameEn, nil
}
// ResetArtifactNameEn resets all changes to the "artifact_name_en" field.
func (m *EpicArtifactInfoMutation) ResetArtifactNameEn() {
m.artifact_name_en = nil
}
// SetImageURL sets the "image_url" field.
func (m *EpicArtifactInfoMutation) SetImageURL(s string) {
m.image_url = &s
}
// ImageURL returns the value of the "image_url" field in the mutation.
func (m *EpicArtifactInfoMutation) ImageURL() (r string, exists bool) {
v := m.image_url
if v == nil {
return
}
return *v, true
}
// OldImageURL returns the old "image_url" field's value of the EpicArtifactInfo entity.
// If the EpicArtifactInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicArtifactInfoMutation) OldImageURL(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldImageURL is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldImageURL requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldImageURL: %w", err)
}
return oldValue.ImageURL, nil
}
// ResetImageURL resets all changes to the "image_url" field.
func (m *EpicArtifactInfoMutation) ResetImageURL() {
m.image_url = nil
}
// Where appends a list predicates to the EpicArtifactInfoMutation builder.
func (m *EpicArtifactInfoMutation) Where(ps ...predicate.EpicArtifactInfo) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicArtifactInfoMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicArtifactInfoMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicArtifactInfo, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicArtifactInfoMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicArtifactInfoMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicArtifactInfo).
func (m *EpicArtifactInfoMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicArtifactInfoMutation) Fields() []string {
fields := make([]string, 0, 14)
if m.artifact_name != nil {
fields = append(fields, epicartifactinfo.FieldArtifactName)
}
if m.artifact_code != nil {
fields = append(fields, epicartifactinfo.FieldArtifactCode)
}
if m.creator != nil {
fields = append(fields, epicartifactinfo.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicartifactinfo.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicartifactinfo.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicartifactinfo.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicartifactinfo.FieldDeleted)
}
if m.stats_health != nil {
fields = append(fields, epicartifactinfo.FieldStatsHealth)
}
if m.stats_attack != nil {
fields = append(fields, epicartifactinfo.FieldStatsAttack)
}
if m.stats_defense != nil {
fields = append(fields, epicartifactinfo.FieldStatsDefense)
}
if m.rarity != nil {
fields = append(fields, epicartifactinfo.FieldRarity)
}
if m.role != nil {
fields = append(fields, epicartifactinfo.FieldRole)
}
if m.artifact_name_en != nil {
fields = append(fields, epicartifactinfo.FieldArtifactNameEn)
}
if m.image_url != nil {
fields = append(fields, epicartifactinfo.FieldImageURL)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicArtifactInfoMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicartifactinfo.FieldArtifactName:
return m.ArtifactName()
case epicartifactinfo.FieldArtifactCode:
return m.ArtifactCode()
case epicartifactinfo.FieldCreator:
return m.Creator()
case epicartifactinfo.FieldCreateTime:
return m.CreateTime()
case epicartifactinfo.FieldUpdater:
return m.Updater()
case epicartifactinfo.FieldUpdateTime:
return m.UpdateTime()
case epicartifactinfo.FieldDeleted:
return m.Deleted()
case epicartifactinfo.FieldStatsHealth:
return m.StatsHealth()
case epicartifactinfo.FieldStatsAttack:
return m.StatsAttack()
case epicartifactinfo.FieldStatsDefense:
return m.StatsDefense()
case epicartifactinfo.FieldRarity:
return m.Rarity()
case epicartifactinfo.FieldRole:
return m.Role()
case epicartifactinfo.FieldArtifactNameEn:
return m.ArtifactNameEn()
case epicartifactinfo.FieldImageURL:
return m.ImageURL()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicArtifactInfoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicartifactinfo.FieldArtifactName:
return m.OldArtifactName(ctx)
case epicartifactinfo.FieldArtifactCode:
return m.OldArtifactCode(ctx)
case epicartifactinfo.FieldCreator:
return m.OldCreator(ctx)
case epicartifactinfo.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicartifactinfo.FieldUpdater:
return m.OldUpdater(ctx)
case epicartifactinfo.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicartifactinfo.FieldDeleted:
return m.OldDeleted(ctx)
case epicartifactinfo.FieldStatsHealth:
return m.OldStatsHealth(ctx)
case epicartifactinfo.FieldStatsAttack:
return m.OldStatsAttack(ctx)
case epicartifactinfo.FieldStatsDefense:
return m.OldStatsDefense(ctx)
case epicartifactinfo.FieldRarity:
return m.OldRarity(ctx)
case epicartifactinfo.FieldRole:
return m.OldRole(ctx)
case epicartifactinfo.FieldArtifactNameEn:
return m.OldArtifactNameEn(ctx)
case epicartifactinfo.FieldImageURL:
return m.OldImageURL(ctx)
}
return nil, fmt.Errorf("unknown EpicArtifactInfo field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicArtifactInfoMutation) SetField(name string, value ent.Value) error {
switch name {
case epicartifactinfo.FieldArtifactName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetArtifactName(v)
return nil
case epicartifactinfo.FieldArtifactCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetArtifactCode(v)
return nil
case epicartifactinfo.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicartifactinfo.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicartifactinfo.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicartifactinfo.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicartifactinfo.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
case epicartifactinfo.FieldStatsHealth:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStatsHealth(v)
return nil
case epicartifactinfo.FieldStatsAttack:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStatsAttack(v)
return nil
case epicartifactinfo.FieldStatsDefense:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStatsDefense(v)
return nil
case epicartifactinfo.FieldRarity:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRarity(v)
return nil
case epicartifactinfo.FieldRole:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRole(v)
return nil
case epicartifactinfo.FieldArtifactNameEn:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetArtifactNameEn(v)
return nil
case epicartifactinfo.FieldImageURL:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetImageURL(v)
return nil
}
return fmt.Errorf("unknown EpicArtifactInfo field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicArtifactInfoMutation) AddedFields() []string {
var fields []string
if m.addstats_health != nil {
fields = append(fields, epicartifactinfo.FieldStatsHealth)
}
if m.addstats_attack != nil {
fields = append(fields, epicartifactinfo.FieldStatsAttack)
}
if m.addstats_defense != nil {
fields = append(fields, epicartifactinfo.FieldStatsDefense)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicArtifactInfoMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case epicartifactinfo.FieldStatsHealth:
return m.AddedStatsHealth()
case epicartifactinfo.FieldStatsAttack:
return m.AddedStatsAttack()
case epicartifactinfo.FieldStatsDefense:
return m.AddedStatsDefense()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicArtifactInfoMutation) AddField(name string, value ent.Value) error {
switch name {
case epicartifactinfo.FieldStatsHealth:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddStatsHealth(v)
return nil
case epicartifactinfo.FieldStatsAttack:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddStatsAttack(v)
return nil
case epicartifactinfo.FieldStatsDefense:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddStatsDefense(v)
return nil
}
return fmt.Errorf("unknown EpicArtifactInfo numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicArtifactInfoMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicartifactinfo.FieldCreateTime) {
fields = append(fields, epicartifactinfo.FieldCreateTime)
}
if m.FieldCleared(epicartifactinfo.FieldUpdateTime) {
fields = append(fields, epicartifactinfo.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicArtifactInfoMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicArtifactInfoMutation) ClearField(name string) error {
switch name {
case epicartifactinfo.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicartifactinfo.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicArtifactInfo nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicArtifactInfoMutation) ResetField(name string) error {
switch name {
case epicartifactinfo.FieldArtifactName:
m.ResetArtifactName()
return nil
case epicartifactinfo.FieldArtifactCode:
m.ResetArtifactCode()
return nil
case epicartifactinfo.FieldCreator:
m.ResetCreator()
return nil
case epicartifactinfo.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicartifactinfo.FieldUpdater:
m.ResetUpdater()
return nil
case epicartifactinfo.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicartifactinfo.FieldDeleted:
m.ResetDeleted()
return nil
case epicartifactinfo.FieldStatsHealth:
m.ResetStatsHealth()
return nil
case epicartifactinfo.FieldStatsAttack:
m.ResetStatsAttack()
return nil
case epicartifactinfo.FieldStatsDefense:
m.ResetStatsDefense()
return nil
case epicartifactinfo.FieldRarity:
m.ResetRarity()
return nil
case epicartifactinfo.FieldRole:
m.ResetRole()
return nil
case epicartifactinfo.FieldArtifactNameEn:
m.ResetArtifactNameEn()
return nil
case epicartifactinfo.FieldImageURL:
m.ResetImageURL()
return nil
}
return fmt.Errorf("unknown EpicArtifactInfo field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicArtifactInfoMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicArtifactInfoMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicArtifactInfoMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicArtifactInfoMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicArtifactInfoMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicArtifactInfoMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicArtifactInfoMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicArtifactInfo unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicArtifactInfoMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicArtifactInfo edge %s", name)
}
// EpicGvgAttackTeamsMutation represents an operation that mutates the EpicGvgAttackTeams nodes in the graph.
type EpicGvgAttackTeamsMutation struct {
config
op Op
typ string
id *int64
attack_heroes *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicGvgAttackTeams, error)
predicates []predicate.EpicGvgAttackTeams
}
var _ ent.Mutation = (*EpicGvgAttackTeamsMutation)(nil)
// epicgvgattackteamsOption allows management of the mutation configuration using functional options.
type epicgvgattackteamsOption func(*EpicGvgAttackTeamsMutation)
// newEpicGvgAttackTeamsMutation creates new mutation for the EpicGvgAttackTeams entity.
func newEpicGvgAttackTeamsMutation(c config, op Op, opts ...epicgvgattackteamsOption) *EpicGvgAttackTeamsMutation {
m := &EpicGvgAttackTeamsMutation{
config: c,
op: op,
typ: TypeEpicGvgAttackTeams,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicGvgAttackTeamsID sets the ID field of the mutation.
func withEpicGvgAttackTeamsID(id int64) epicgvgattackteamsOption {
return func(m *EpicGvgAttackTeamsMutation) {
var (
err error
once sync.Once
value *EpicGvgAttackTeams
)
m.oldValue = func(ctx context.Context) (*EpicGvgAttackTeams, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicGvgAttackTeams.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicGvgAttackTeams sets the old EpicGvgAttackTeams of the mutation.
func withEpicGvgAttackTeams(node *EpicGvgAttackTeams) epicgvgattackteamsOption {
return func(m *EpicGvgAttackTeamsMutation) {
m.oldValue = func(context.Context) (*EpicGvgAttackTeams, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicGvgAttackTeamsMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicGvgAttackTeamsMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicGvgAttackTeams entities.
func (m *EpicGvgAttackTeamsMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicGvgAttackTeamsMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicGvgAttackTeamsMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicGvgAttackTeams.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetAttackHeroes sets the "attack_heroes" field.
func (m *EpicGvgAttackTeamsMutation) SetAttackHeroes(s string) {
m.attack_heroes = &s
}
// AttackHeroes returns the value of the "attack_heroes" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) AttackHeroes() (r string, exists bool) {
v := m.attack_heroes
if v == nil {
return
}
return *v, true
}
// OldAttackHeroes returns the old "attack_heroes" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldAttackHeroes(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAttackHeroes is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAttackHeroes requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAttackHeroes: %w", err)
}
return oldValue.AttackHeroes, nil
}
// ResetAttackHeroes resets all changes to the "attack_heroes" field.
func (m *EpicGvgAttackTeamsMutation) ResetAttackHeroes() {
m.attack_heroes = nil
}
// SetCreator sets the "creator" field.
func (m *EpicGvgAttackTeamsMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicGvgAttackTeamsMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicGvgAttackTeamsMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicGvgAttackTeamsMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicgvgattackteams.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicGvgAttackTeamsMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgattackteams.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicGvgAttackTeamsMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicgvgattackteams.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicGvgAttackTeamsMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicGvgAttackTeamsMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicGvgAttackTeamsMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicGvgAttackTeamsMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicgvgattackteams.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicGvgAttackTeamsMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgattackteams.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicGvgAttackTeamsMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicgvgattackteams.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicGvgAttackTeamsMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicGvgAttackTeamsMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicGvgAttackTeams entity.
// If the EpicGvgAttackTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgAttackTeamsMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicGvgAttackTeamsMutation) ResetDeleted() {
m.deleted = nil
}
// Where appends a list predicates to the EpicGvgAttackTeamsMutation builder.
func (m *EpicGvgAttackTeamsMutation) Where(ps ...predicate.EpicGvgAttackTeams) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicGvgAttackTeamsMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicGvgAttackTeamsMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicGvgAttackTeams, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicGvgAttackTeamsMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicGvgAttackTeamsMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicGvgAttackTeams).
func (m *EpicGvgAttackTeamsMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicGvgAttackTeamsMutation) Fields() []string {
fields := make([]string, 0, 6)
if m.attack_heroes != nil {
fields = append(fields, epicgvgattackteams.FieldAttackHeroes)
}
if m.creator != nil {
fields = append(fields, epicgvgattackteams.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicgvgattackteams.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicgvgattackteams.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicgvgattackteams.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicgvgattackteams.FieldDeleted)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicGvgAttackTeamsMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicgvgattackteams.FieldAttackHeroes:
return m.AttackHeroes()
case epicgvgattackteams.FieldCreator:
return m.Creator()
case epicgvgattackteams.FieldCreateTime:
return m.CreateTime()
case epicgvgattackteams.FieldUpdater:
return m.Updater()
case epicgvgattackteams.FieldUpdateTime:
return m.UpdateTime()
case epicgvgattackteams.FieldDeleted:
return m.Deleted()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicGvgAttackTeamsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicgvgattackteams.FieldAttackHeroes:
return m.OldAttackHeroes(ctx)
case epicgvgattackteams.FieldCreator:
return m.OldCreator(ctx)
case epicgvgattackteams.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicgvgattackteams.FieldUpdater:
return m.OldUpdater(ctx)
case epicgvgattackteams.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicgvgattackteams.FieldDeleted:
return m.OldDeleted(ctx)
}
return nil, fmt.Errorf("unknown EpicGvgAttackTeams field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgAttackTeamsMutation) SetField(name string, value ent.Value) error {
switch name {
case epicgvgattackteams.FieldAttackHeroes:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAttackHeroes(v)
return nil
case epicgvgattackteams.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicgvgattackteams.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicgvgattackteams.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicgvgattackteams.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicgvgattackteams.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
}
return fmt.Errorf("unknown EpicGvgAttackTeams field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicGvgAttackTeamsMutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicGvgAttackTeamsMutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgAttackTeamsMutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown EpicGvgAttackTeams numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicGvgAttackTeamsMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicgvgattackteams.FieldCreateTime) {
fields = append(fields, epicgvgattackteams.FieldCreateTime)
}
if m.FieldCleared(epicgvgattackteams.FieldUpdateTime) {
fields = append(fields, epicgvgattackteams.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicGvgAttackTeamsMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicGvgAttackTeamsMutation) ClearField(name string) error {
switch name {
case epicgvgattackteams.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicgvgattackteams.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicGvgAttackTeams nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicGvgAttackTeamsMutation) ResetField(name string) error {
switch name {
case epicgvgattackteams.FieldAttackHeroes:
m.ResetAttackHeroes()
return nil
case epicgvgattackteams.FieldCreator:
m.ResetCreator()
return nil
case epicgvgattackteams.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicgvgattackteams.FieldUpdater:
m.ResetUpdater()
return nil
case epicgvgattackteams.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicgvgattackteams.FieldDeleted:
m.ResetDeleted()
return nil
}
return fmt.Errorf("unknown EpicGvgAttackTeams field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicGvgAttackTeamsMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicGvgAttackTeamsMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicGvgAttackTeamsMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicGvgAttackTeamsMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicGvgAttackTeamsMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicGvgAttackTeamsMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicGvgAttackTeamsMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicGvgAttackTeams unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicGvgAttackTeamsMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicGvgAttackTeams edge %s", name)
}
// EpicGvgDefenseAttackMappingMutation represents an operation that mutates the EpicGvgDefenseAttackMapping nodes in the graph.
type EpicGvgDefenseAttackMappingMutation struct {
config
op Op
typ string
id *int64
defense_id *int64
adddefense_id *int64
attack_id *int64
addattack_id *int64
equipment_info *string
artifacts *string
battle_strategy *string
prerequisites *string
important_notes *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicGvgDefenseAttackMapping, error)
predicates []predicate.EpicGvgDefenseAttackMapping
}
var _ ent.Mutation = (*EpicGvgDefenseAttackMappingMutation)(nil)
// epicgvgdefenseattackmappingOption allows management of the mutation configuration using functional options.
type epicgvgdefenseattackmappingOption func(*EpicGvgDefenseAttackMappingMutation)
// newEpicGvgDefenseAttackMappingMutation creates new mutation for the EpicGvgDefenseAttackMapping entity.
func newEpicGvgDefenseAttackMappingMutation(c config, op Op, opts ...epicgvgdefenseattackmappingOption) *EpicGvgDefenseAttackMappingMutation {
m := &EpicGvgDefenseAttackMappingMutation{
config: c,
op: op,
typ: TypeEpicGvgDefenseAttackMapping,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicGvgDefenseAttackMappingID sets the ID field of the mutation.
func withEpicGvgDefenseAttackMappingID(id int64) epicgvgdefenseattackmappingOption {
return func(m *EpicGvgDefenseAttackMappingMutation) {
var (
err error
once sync.Once
value *EpicGvgDefenseAttackMapping
)
m.oldValue = func(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicGvgDefenseAttackMapping.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicGvgDefenseAttackMapping sets the old EpicGvgDefenseAttackMapping of the mutation.
func withEpicGvgDefenseAttackMapping(node *EpicGvgDefenseAttackMapping) epicgvgdefenseattackmappingOption {
return func(m *EpicGvgDefenseAttackMappingMutation) {
m.oldValue = func(context.Context) (*EpicGvgDefenseAttackMapping, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicGvgDefenseAttackMappingMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicGvgDefenseAttackMappingMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicGvgDefenseAttackMapping entities.
func (m *EpicGvgDefenseAttackMappingMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicGvgDefenseAttackMappingMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicGvgDefenseAttackMapping.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetDefenseID sets the "defense_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetDefenseID(i int64) {
m.defense_id = &i
m.adddefense_id = nil
}
// DefenseID returns the value of the "defense_id" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) DefenseID() (r int64, exists bool) {
v := m.defense_id
if v == nil {
return
}
return *v, true
}
// OldDefenseID returns the old "defense_id" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldDefenseID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDefenseID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDefenseID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDefenseID: %w", err)
}
return oldValue.DefenseID, nil
}
// AddDefenseID adds i to the "defense_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) AddDefenseID(i int64) {
if m.adddefense_id != nil {
*m.adddefense_id += i
} else {
m.adddefense_id = &i
}
}
// AddedDefenseID returns the value that was added to the "defense_id" field in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AddedDefenseID() (r int64, exists bool) {
v := m.adddefense_id
if v == nil {
return
}
return *v, true
}
// ResetDefenseID resets all changes to the "defense_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetDefenseID() {
m.defense_id = nil
m.adddefense_id = nil
}
// SetAttackID sets the "attack_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetAttackID(i int64) {
m.attack_id = &i
m.addattack_id = nil
}
// AttackID returns the value of the "attack_id" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AttackID() (r int64, exists bool) {
v := m.attack_id
if v == nil {
return
}
return *v, true
}
// OldAttackID returns the old "attack_id" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldAttackID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAttackID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAttackID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAttackID: %w", err)
}
return oldValue.AttackID, nil
}
// AddAttackID adds i to the "attack_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) AddAttackID(i int64) {
if m.addattack_id != nil {
*m.addattack_id += i
} else {
m.addattack_id = &i
}
}
// AddedAttackID returns the value that was added to the "attack_id" field in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AddedAttackID() (r int64, exists bool) {
v := m.addattack_id
if v == nil {
return
}
return *v, true
}
// ResetAttackID resets all changes to the "attack_id" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetAttackID() {
m.attack_id = nil
m.addattack_id = nil
}
// SetEquipmentInfo sets the "equipment_info" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetEquipmentInfo(s string) {
m.equipment_info = &s
}
// EquipmentInfo returns the value of the "equipment_info" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) EquipmentInfo() (r string, exists bool) {
v := m.equipment_info
if v == nil {
return
}
return *v, true
}
// OldEquipmentInfo returns the old "equipment_info" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldEquipmentInfo(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldEquipmentInfo is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldEquipmentInfo requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldEquipmentInfo: %w", err)
}
return oldValue.EquipmentInfo, nil
}
// ResetEquipmentInfo resets all changes to the "equipment_info" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetEquipmentInfo() {
m.equipment_info = nil
}
// SetArtifacts sets the "artifacts" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetArtifacts(s string) {
m.artifacts = &s
}
// Artifacts returns the value of the "artifacts" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) Artifacts() (r string, exists bool) {
v := m.artifacts
if v == nil {
return
}
return *v, true
}
// OldArtifacts returns the old "artifacts" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldArtifacts(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldArtifacts is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldArtifacts requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldArtifacts: %w", err)
}
return oldValue.Artifacts, nil
}
// ResetArtifacts resets all changes to the "artifacts" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetArtifacts() {
m.artifacts = nil
}
// SetBattleStrategy sets the "battle_strategy" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetBattleStrategy(s string) {
m.battle_strategy = &s
}
// BattleStrategy returns the value of the "battle_strategy" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) BattleStrategy() (r string, exists bool) {
v := m.battle_strategy
if v == nil {
return
}
return *v, true
}
// OldBattleStrategy returns the old "battle_strategy" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldBattleStrategy(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldBattleStrategy is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldBattleStrategy requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldBattleStrategy: %w", err)
}
return oldValue.BattleStrategy, nil
}
// ResetBattleStrategy resets all changes to the "battle_strategy" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetBattleStrategy() {
m.battle_strategy = nil
}
// SetPrerequisites sets the "prerequisites" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetPrerequisites(s string) {
m.prerequisites = &s
}
// Prerequisites returns the value of the "prerequisites" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) Prerequisites() (r string, exists bool) {
v := m.prerequisites
if v == nil {
return
}
return *v, true
}
// OldPrerequisites returns the old "prerequisites" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldPrerequisites(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldPrerequisites is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldPrerequisites requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldPrerequisites: %w", err)
}
return oldValue.Prerequisites, nil
}
// ResetPrerequisites resets all changes to the "prerequisites" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetPrerequisites() {
m.prerequisites = nil
}
// SetImportantNotes sets the "important_notes" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetImportantNotes(s string) {
m.important_notes = &s
}
// ImportantNotes returns the value of the "important_notes" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) ImportantNotes() (r string, exists bool) {
v := m.important_notes
if v == nil {
return
}
return *v, true
}
// OldImportantNotes returns the old "important_notes" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldImportantNotes(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldImportantNotes is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldImportantNotes requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldImportantNotes: %w", err)
}
return oldValue.ImportantNotes, nil
}
// ResetImportantNotes resets all changes to the "important_notes" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetImportantNotes() {
m.important_notes = nil
}
// SetCreator sets the "creator" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicgvgdefenseattackmapping.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgdefenseattackmapping.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicgvgdefenseattackmapping.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicgvgdefenseattackmapping.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgdefenseattackmapping.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicgvgdefenseattackmapping.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicGvgDefenseAttackMappingMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicGvgDefenseAttackMappingMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicGvgDefenseAttackMapping entity.
// If the EpicGvgDefenseAttackMapping object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseAttackMappingMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicGvgDefenseAttackMappingMutation) ResetDeleted() {
m.deleted = nil
}
// Where appends a list predicates to the EpicGvgDefenseAttackMappingMutation builder.
func (m *EpicGvgDefenseAttackMappingMutation) Where(ps ...predicate.EpicGvgDefenseAttackMapping) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicGvgDefenseAttackMappingMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicGvgDefenseAttackMappingMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicGvgDefenseAttackMapping, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicGvgDefenseAttackMappingMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicGvgDefenseAttackMappingMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicGvgDefenseAttackMapping).
func (m *EpicGvgDefenseAttackMappingMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicGvgDefenseAttackMappingMutation) Fields() []string {
fields := make([]string, 0, 12)
if m.defense_id != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldDefenseID)
}
if m.attack_id != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldAttackID)
}
if m.equipment_info != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldEquipmentInfo)
}
if m.artifacts != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldArtifacts)
}
if m.battle_strategy != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldBattleStrategy)
}
if m.prerequisites != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldPrerequisites)
}
if m.important_notes != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldImportantNotes)
}
if m.creator != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldDeleted)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicGvgDefenseAttackMappingMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
return m.DefenseID()
case epicgvgdefenseattackmapping.FieldAttackID:
return m.AttackID()
case epicgvgdefenseattackmapping.FieldEquipmentInfo:
return m.EquipmentInfo()
case epicgvgdefenseattackmapping.FieldArtifacts:
return m.Artifacts()
case epicgvgdefenseattackmapping.FieldBattleStrategy:
return m.BattleStrategy()
case epicgvgdefenseattackmapping.FieldPrerequisites:
return m.Prerequisites()
case epicgvgdefenseattackmapping.FieldImportantNotes:
return m.ImportantNotes()
case epicgvgdefenseattackmapping.FieldCreator:
return m.Creator()
case epicgvgdefenseattackmapping.FieldCreateTime:
return m.CreateTime()
case epicgvgdefenseattackmapping.FieldUpdater:
return m.Updater()
case epicgvgdefenseattackmapping.FieldUpdateTime:
return m.UpdateTime()
case epicgvgdefenseattackmapping.FieldDeleted:
return m.Deleted()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicGvgDefenseAttackMappingMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
return m.OldDefenseID(ctx)
case epicgvgdefenseattackmapping.FieldAttackID:
return m.OldAttackID(ctx)
case epicgvgdefenseattackmapping.FieldEquipmentInfo:
return m.OldEquipmentInfo(ctx)
case epicgvgdefenseattackmapping.FieldArtifacts:
return m.OldArtifacts(ctx)
case epicgvgdefenseattackmapping.FieldBattleStrategy:
return m.OldBattleStrategy(ctx)
case epicgvgdefenseattackmapping.FieldPrerequisites:
return m.OldPrerequisites(ctx)
case epicgvgdefenseattackmapping.FieldImportantNotes:
return m.OldImportantNotes(ctx)
case epicgvgdefenseattackmapping.FieldCreator:
return m.OldCreator(ctx)
case epicgvgdefenseattackmapping.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicgvgdefenseattackmapping.FieldUpdater:
return m.OldUpdater(ctx)
case epicgvgdefenseattackmapping.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicgvgdefenseattackmapping.FieldDeleted:
return m.OldDeleted(ctx)
}
return nil, fmt.Errorf("unknown EpicGvgDefenseAttackMapping field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgDefenseAttackMappingMutation) SetField(name string, value ent.Value) error {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDefenseID(v)
return nil
case epicgvgdefenseattackmapping.FieldAttackID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAttackID(v)
return nil
case epicgvgdefenseattackmapping.FieldEquipmentInfo:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetEquipmentInfo(v)
return nil
case epicgvgdefenseattackmapping.FieldArtifacts:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetArtifacts(v)
return nil
case epicgvgdefenseattackmapping.FieldBattleStrategy:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetBattleStrategy(v)
return nil
case epicgvgdefenseattackmapping.FieldPrerequisites:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetPrerequisites(v)
return nil
case epicgvgdefenseattackmapping.FieldImportantNotes:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetImportantNotes(v)
return nil
case epicgvgdefenseattackmapping.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicgvgdefenseattackmapping.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicgvgdefenseattackmapping.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicgvgdefenseattackmapping.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicgvgdefenseattackmapping.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AddedFields() []string {
var fields []string
if m.adddefense_id != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldDefenseID)
}
if m.addattack_id != nil {
fields = append(fields, epicgvgdefenseattackmapping.FieldAttackID)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicGvgDefenseAttackMappingMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
return m.AddedDefenseID()
case epicgvgdefenseattackmapping.FieldAttackID:
return m.AddedAttackID()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgDefenseAttackMappingMutation) AddField(name string, value ent.Value) error {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddDefenseID(v)
return nil
case epicgvgdefenseattackmapping.FieldAttackID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddAttackID(v)
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicGvgDefenseAttackMappingMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicgvgdefenseattackmapping.FieldCreateTime) {
fields = append(fields, epicgvgdefenseattackmapping.FieldCreateTime)
}
if m.FieldCleared(epicgvgdefenseattackmapping.FieldUpdateTime) {
fields = append(fields, epicgvgdefenseattackmapping.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicGvgDefenseAttackMappingMutation) ClearField(name string) error {
switch name {
case epicgvgdefenseattackmapping.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicgvgdefenseattackmapping.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicGvgDefenseAttackMappingMutation) ResetField(name string) error {
switch name {
case epicgvgdefenseattackmapping.FieldDefenseID:
m.ResetDefenseID()
return nil
case epicgvgdefenseattackmapping.FieldAttackID:
m.ResetAttackID()
return nil
case epicgvgdefenseattackmapping.FieldEquipmentInfo:
m.ResetEquipmentInfo()
return nil
case epicgvgdefenseattackmapping.FieldArtifacts:
m.ResetArtifacts()
return nil
case epicgvgdefenseattackmapping.FieldBattleStrategy:
m.ResetBattleStrategy()
return nil
case epicgvgdefenseattackmapping.FieldPrerequisites:
m.ResetPrerequisites()
return nil
case epicgvgdefenseattackmapping.FieldImportantNotes:
m.ResetImportantNotes()
return nil
case epicgvgdefenseattackmapping.FieldCreator:
m.ResetCreator()
return nil
case epicgvgdefenseattackmapping.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicgvgdefenseattackmapping.FieldUpdater:
m.ResetUpdater()
return nil
case epicgvgdefenseattackmapping.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicgvgdefenseattackmapping.FieldDeleted:
m.ResetDeleted()
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicGvgDefenseAttackMappingMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicGvgDefenseAttackMappingMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicGvgDefenseAttackMappingMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicGvgDefenseAttackMapping edge %s", name)
}
// EpicGvgDefenseTeamsMutation represents an operation that mutates the EpicGvgDefenseTeams nodes in the graph.
type EpicGvgDefenseTeamsMutation struct {
config
op Op
typ string
id *int64
defense_heroes *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicGvgDefenseTeams, error)
predicates []predicate.EpicGvgDefenseTeams
}
var _ ent.Mutation = (*EpicGvgDefenseTeamsMutation)(nil)
// epicgvgdefenseteamsOption allows management of the mutation configuration using functional options.
type epicgvgdefenseteamsOption func(*EpicGvgDefenseTeamsMutation)
// newEpicGvgDefenseTeamsMutation creates new mutation for the EpicGvgDefenseTeams entity.
func newEpicGvgDefenseTeamsMutation(c config, op Op, opts ...epicgvgdefenseteamsOption) *EpicGvgDefenseTeamsMutation {
m := &EpicGvgDefenseTeamsMutation{
config: c,
op: op,
typ: TypeEpicGvgDefenseTeams,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicGvgDefenseTeamsID sets the ID field of the mutation.
func withEpicGvgDefenseTeamsID(id int64) epicgvgdefenseteamsOption {
return func(m *EpicGvgDefenseTeamsMutation) {
var (
err error
once sync.Once
value *EpicGvgDefenseTeams
)
m.oldValue = func(ctx context.Context) (*EpicGvgDefenseTeams, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicGvgDefenseTeams.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicGvgDefenseTeams sets the old EpicGvgDefenseTeams of the mutation.
func withEpicGvgDefenseTeams(node *EpicGvgDefenseTeams) epicgvgdefenseteamsOption {
return func(m *EpicGvgDefenseTeamsMutation) {
m.oldValue = func(context.Context) (*EpicGvgDefenseTeams, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicGvgDefenseTeamsMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicGvgDefenseTeamsMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicGvgDefenseTeams entities.
func (m *EpicGvgDefenseTeamsMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicGvgDefenseTeamsMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicGvgDefenseTeamsMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicGvgDefenseTeams.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetDefenseHeroes sets the "defense_heroes" field.
func (m *EpicGvgDefenseTeamsMutation) SetDefenseHeroes(s string) {
m.defense_heroes = &s
}
// DefenseHeroes returns the value of the "defense_heroes" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) DefenseHeroes() (r string, exists bool) {
v := m.defense_heroes
if v == nil {
return
}
return *v, true
}
// OldDefenseHeroes returns the old "defense_heroes" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldDefenseHeroes(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDefenseHeroes is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDefenseHeroes requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDefenseHeroes: %w", err)
}
return oldValue.DefenseHeroes, nil
}
// ResetDefenseHeroes resets all changes to the "defense_heroes" field.
func (m *EpicGvgDefenseTeamsMutation) ResetDefenseHeroes() {
m.defense_heroes = nil
}
// SetCreator sets the "creator" field.
func (m *EpicGvgDefenseTeamsMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicGvgDefenseTeamsMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicGvgDefenseTeamsMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicGvgDefenseTeamsMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicgvgdefenseteams.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicGvgDefenseTeamsMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgdefenseteams.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicGvgDefenseTeamsMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicgvgdefenseteams.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicGvgDefenseTeamsMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicGvgDefenseTeamsMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicGvgDefenseTeamsMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicGvgDefenseTeamsMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicgvgdefenseteams.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicGvgDefenseTeamsMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicgvgdefenseteams.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicGvgDefenseTeamsMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicgvgdefenseteams.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicGvgDefenseTeamsMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicGvgDefenseTeamsMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicGvgDefenseTeams entity.
// If the EpicGvgDefenseTeams object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicGvgDefenseTeamsMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicGvgDefenseTeamsMutation) ResetDeleted() {
m.deleted = nil
}
// Where appends a list predicates to the EpicGvgDefenseTeamsMutation builder.
func (m *EpicGvgDefenseTeamsMutation) Where(ps ...predicate.EpicGvgDefenseTeams) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicGvgDefenseTeamsMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicGvgDefenseTeamsMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicGvgDefenseTeams, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicGvgDefenseTeamsMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicGvgDefenseTeamsMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicGvgDefenseTeams).
func (m *EpicGvgDefenseTeamsMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicGvgDefenseTeamsMutation) Fields() []string {
fields := make([]string, 0, 6)
if m.defense_heroes != nil {
fields = append(fields, epicgvgdefenseteams.FieldDefenseHeroes)
}
if m.creator != nil {
fields = append(fields, epicgvgdefenseteams.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicgvgdefenseteams.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicgvgdefenseteams.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicgvgdefenseteams.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicgvgdefenseteams.FieldDeleted)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicGvgDefenseTeamsMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicgvgdefenseteams.FieldDefenseHeroes:
return m.DefenseHeroes()
case epicgvgdefenseteams.FieldCreator:
return m.Creator()
case epicgvgdefenseteams.FieldCreateTime:
return m.CreateTime()
case epicgvgdefenseteams.FieldUpdater:
return m.Updater()
case epicgvgdefenseteams.FieldUpdateTime:
return m.UpdateTime()
case epicgvgdefenseteams.FieldDeleted:
return m.Deleted()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicGvgDefenseTeamsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicgvgdefenseteams.FieldDefenseHeroes:
return m.OldDefenseHeroes(ctx)
case epicgvgdefenseteams.FieldCreator:
return m.OldCreator(ctx)
case epicgvgdefenseteams.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicgvgdefenseteams.FieldUpdater:
return m.OldUpdater(ctx)
case epicgvgdefenseteams.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicgvgdefenseteams.FieldDeleted:
return m.OldDeleted(ctx)
}
return nil, fmt.Errorf("unknown EpicGvgDefenseTeams field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgDefenseTeamsMutation) SetField(name string, value ent.Value) error {
switch name {
case epicgvgdefenseteams.FieldDefenseHeroes:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDefenseHeroes(v)
return nil
case epicgvgdefenseteams.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicgvgdefenseteams.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicgvgdefenseteams.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicgvgdefenseteams.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicgvgdefenseteams.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseTeams field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicGvgDefenseTeamsMutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicGvgDefenseTeamsMutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicGvgDefenseTeamsMutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown EpicGvgDefenseTeams numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicGvgDefenseTeamsMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicgvgdefenseteams.FieldCreateTime) {
fields = append(fields, epicgvgdefenseteams.FieldCreateTime)
}
if m.FieldCleared(epicgvgdefenseteams.FieldUpdateTime) {
fields = append(fields, epicgvgdefenseteams.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicGvgDefenseTeamsMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicGvgDefenseTeamsMutation) ClearField(name string) error {
switch name {
case epicgvgdefenseteams.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicgvgdefenseteams.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseTeams nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicGvgDefenseTeamsMutation) ResetField(name string) error {
switch name {
case epicgvgdefenseteams.FieldDefenseHeroes:
m.ResetDefenseHeroes()
return nil
case epicgvgdefenseteams.FieldCreator:
m.ResetCreator()
return nil
case epicgvgdefenseteams.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicgvgdefenseteams.FieldUpdater:
m.ResetUpdater()
return nil
case epicgvgdefenseteams.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicgvgdefenseteams.FieldDeleted:
m.ResetDeleted()
return nil
}
return fmt.Errorf("unknown EpicGvgDefenseTeams field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicGvgDefenseTeamsMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicGvgDefenseTeamsMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicGvgDefenseTeamsMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicGvgDefenseTeamsMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicGvgDefenseTeamsMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicGvgDefenseTeamsMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicGvgDefenseTeamsMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicGvgDefenseTeams unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicGvgDefenseTeamsMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicGvgDefenseTeams edge %s", name)
}
// EpicHeroInfoMutation represents an operation that mutates the EpicHeroInfo nodes in the graph.
type EpicHeroInfoMutation struct {
config
op Op
typ string
id *int64
hero_name *string
hero_code *string
hero_attr_lv60 *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
nick_name *string
rarity *string
role *string
zodiac *string
head_img_url *string
attribute *string
remark *string
raw_json *string
content_json_set *string
update_time_set *time.Time
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicHeroInfo, error)
predicates []predicate.EpicHeroInfo
}
var _ ent.Mutation = (*EpicHeroInfoMutation)(nil)
// epicheroinfoOption allows management of the mutation configuration using functional options.
type epicheroinfoOption func(*EpicHeroInfoMutation)
// newEpicHeroInfoMutation creates new mutation for the EpicHeroInfo entity.
func newEpicHeroInfoMutation(c config, op Op, opts ...epicheroinfoOption) *EpicHeroInfoMutation {
m := &EpicHeroInfoMutation{
config: c,
op: op,
typ: TypeEpicHeroInfo,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicHeroInfoID sets the ID field of the mutation.
func withEpicHeroInfoID(id int64) epicheroinfoOption {
return func(m *EpicHeroInfoMutation) {
var (
err error
once sync.Once
value *EpicHeroInfo
)
m.oldValue = func(ctx context.Context) (*EpicHeroInfo, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicHeroInfo.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicHeroInfo sets the old EpicHeroInfo of the mutation.
func withEpicHeroInfo(node *EpicHeroInfo) epicheroinfoOption {
return func(m *EpicHeroInfoMutation) {
m.oldValue = func(context.Context) (*EpicHeroInfo, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicHeroInfoMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicHeroInfoMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicHeroInfo entities.
func (m *EpicHeroInfoMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicHeroInfoMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicHeroInfoMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicHeroInfo.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetHeroName sets the "hero_name" field.
func (m *EpicHeroInfoMutation) SetHeroName(s string) {
m.hero_name = &s
}
// HeroName returns the value of the "hero_name" field in the mutation.
func (m *EpicHeroInfoMutation) HeroName() (r string, exists bool) {
v := m.hero_name
if v == nil {
return
}
return *v, true
}
// OldHeroName returns the old "hero_name" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldHeroName(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroName is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroName requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroName: %w", err)
}
return oldValue.HeroName, nil
}
// ResetHeroName resets all changes to the "hero_name" field.
func (m *EpicHeroInfoMutation) ResetHeroName() {
m.hero_name = nil
}
// SetHeroCode sets the "hero_code" field.
func (m *EpicHeroInfoMutation) SetHeroCode(s string) {
m.hero_code = &s
}
// HeroCode returns the value of the "hero_code" field in the mutation.
func (m *EpicHeroInfoMutation) HeroCode() (r string, exists bool) {
v := m.hero_code
if v == nil {
return
}
return *v, true
}
// OldHeroCode returns the old "hero_code" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldHeroCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroCode: %w", err)
}
return oldValue.HeroCode, nil
}
// ResetHeroCode resets all changes to the "hero_code" field.
func (m *EpicHeroInfoMutation) ResetHeroCode() {
m.hero_code = nil
}
// SetHeroAttrLv60 sets the "hero_attr_lv60" field.
func (m *EpicHeroInfoMutation) SetHeroAttrLv60(s string) {
m.hero_attr_lv60 = &s
}
// HeroAttrLv60 returns the value of the "hero_attr_lv60" field in the mutation.
func (m *EpicHeroInfoMutation) HeroAttrLv60() (r string, exists bool) {
v := m.hero_attr_lv60
if v == nil {
return
}
return *v, true
}
// OldHeroAttrLv60 returns the old "hero_attr_lv60" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldHeroAttrLv60(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroAttrLv60 is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroAttrLv60 requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroAttrLv60: %w", err)
}
return oldValue.HeroAttrLv60, nil
}
// ResetHeroAttrLv60 resets all changes to the "hero_attr_lv60" field.
func (m *EpicHeroInfoMutation) ResetHeroAttrLv60() {
m.hero_attr_lv60 = nil
}
// SetCreator sets the "creator" field.
func (m *EpicHeroInfoMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicHeroInfoMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicHeroInfoMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicHeroInfoMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicHeroInfoMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicHeroInfoMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicheroinfo.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicHeroInfoMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicheroinfo.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicHeroInfoMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicheroinfo.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicHeroInfoMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicHeroInfoMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicHeroInfoMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicHeroInfoMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicHeroInfoMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicHeroInfoMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicheroinfo.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicHeroInfoMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicheroinfo.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicHeroInfoMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicheroinfo.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicHeroInfoMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicHeroInfoMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicHeroInfoMutation) ResetDeleted() {
m.deleted = nil
}
// SetNickName sets the "nick_name" field.
func (m *EpicHeroInfoMutation) SetNickName(s string) {
m.nick_name = &s
}
// NickName returns the value of the "nick_name" field in the mutation.
func (m *EpicHeroInfoMutation) NickName() (r string, exists bool) {
v := m.nick_name
if v == nil {
return
}
return *v, true
}
// OldNickName returns the old "nick_name" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldNickName(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldNickName is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldNickName requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldNickName: %w", err)
}
return oldValue.NickName, nil
}
// ResetNickName resets all changes to the "nick_name" field.
func (m *EpicHeroInfoMutation) ResetNickName() {
m.nick_name = nil
}
// SetRarity sets the "rarity" field.
func (m *EpicHeroInfoMutation) SetRarity(s string) {
m.rarity = &s
}
// Rarity returns the value of the "rarity" field in the mutation.
func (m *EpicHeroInfoMutation) Rarity() (r string, exists bool) {
v := m.rarity
if v == nil {
return
}
return *v, true
}
// OldRarity returns the old "rarity" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldRarity(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRarity is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRarity requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRarity: %w", err)
}
return oldValue.Rarity, nil
}
// ResetRarity resets all changes to the "rarity" field.
func (m *EpicHeroInfoMutation) ResetRarity() {
m.rarity = nil
}
// SetRole sets the "role" field.
func (m *EpicHeroInfoMutation) SetRole(s string) {
m.role = &s
}
// Role returns the value of the "role" field in the mutation.
func (m *EpicHeroInfoMutation) Role() (r string, exists bool) {
v := m.role
if v == nil {
return
}
return *v, true
}
// OldRole returns the old "role" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldRole(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRole is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRole requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRole: %w", err)
}
return oldValue.Role, nil
}
// ResetRole resets all changes to the "role" field.
func (m *EpicHeroInfoMutation) ResetRole() {
m.role = nil
}
// SetZodiac sets the "zodiac" field.
func (m *EpicHeroInfoMutation) SetZodiac(s string) {
m.zodiac = &s
}
// Zodiac returns the value of the "zodiac" field in the mutation.
func (m *EpicHeroInfoMutation) Zodiac() (r string, exists bool) {
v := m.zodiac
if v == nil {
return
}
return *v, true
}
// OldZodiac returns the old "zodiac" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldZodiac(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldZodiac is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldZodiac requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldZodiac: %w", err)
}
return oldValue.Zodiac, nil
}
// ResetZodiac resets all changes to the "zodiac" field.
func (m *EpicHeroInfoMutation) ResetZodiac() {
m.zodiac = nil
}
// SetHeadImgURL sets the "head_img_url" field.
func (m *EpicHeroInfoMutation) SetHeadImgURL(s string) {
m.head_img_url = &s
}
// HeadImgURL returns the value of the "head_img_url" field in the mutation.
func (m *EpicHeroInfoMutation) HeadImgURL() (r string, exists bool) {
v := m.head_img_url
if v == nil {
return
}
return *v, true
}
// OldHeadImgURL returns the old "head_img_url" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldHeadImgURL(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeadImgURL is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeadImgURL requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeadImgURL: %w", err)
}
return oldValue.HeadImgURL, nil
}
// ResetHeadImgURL resets all changes to the "head_img_url" field.
func (m *EpicHeroInfoMutation) ResetHeadImgURL() {
m.head_img_url = nil
}
// SetAttribute sets the "attribute" field.
func (m *EpicHeroInfoMutation) SetAttribute(s string) {
m.attribute = &s
}
// Attribute returns the value of the "attribute" field in the mutation.
func (m *EpicHeroInfoMutation) Attribute() (r string, exists bool) {
v := m.attribute
if v == nil {
return
}
return *v, true
}
// OldAttribute returns the old "attribute" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldAttribute(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAttribute is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAttribute requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAttribute: %w", err)
}
return oldValue.Attribute, nil
}
// ResetAttribute resets all changes to the "attribute" field.
func (m *EpicHeroInfoMutation) ResetAttribute() {
m.attribute = nil
}
// SetRemark sets the "remark" field.
func (m *EpicHeroInfoMutation) SetRemark(s string) {
m.remark = &s
}
// Remark returns the value of the "remark" field in the mutation.
func (m *EpicHeroInfoMutation) Remark() (r string, exists bool) {
v := m.remark
if v == nil {
return
}
return *v, true
}
// OldRemark returns the old "remark" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldRemark(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRemark is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRemark requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRemark: %w", err)
}
return oldValue.Remark, nil
}
// ResetRemark resets all changes to the "remark" field.
func (m *EpicHeroInfoMutation) ResetRemark() {
m.remark = nil
}
// SetRawJSON sets the "raw_json" field.
func (m *EpicHeroInfoMutation) SetRawJSON(s string) {
m.raw_json = &s
}
// RawJSON returns the value of the "raw_json" field in the mutation.
func (m *EpicHeroInfoMutation) RawJSON() (r string, exists bool) {
v := m.raw_json
if v == nil {
return
}
return *v, true
}
// OldRawJSON returns the old "raw_json" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldRawJSON(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRawJSON is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRawJSON requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRawJSON: %w", err)
}
return oldValue.RawJSON, nil
}
// ResetRawJSON resets all changes to the "raw_json" field.
func (m *EpicHeroInfoMutation) ResetRawJSON() {
m.raw_json = nil
}
// SetContentJSONSet sets the "content_json_set" field.
func (m *EpicHeroInfoMutation) SetContentJSONSet(s string) {
m.content_json_set = &s
}
// ContentJSONSet returns the value of the "content_json_set" field in the mutation.
func (m *EpicHeroInfoMutation) ContentJSONSet() (r string, exists bool) {
v := m.content_json_set
if v == nil {
return
}
return *v, true
}
// OldContentJSONSet returns the old "content_json_set" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldContentJSONSet(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldContentJSONSet is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldContentJSONSet requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldContentJSONSet: %w", err)
}
return oldValue.ContentJSONSet, nil
}
// ResetContentJSONSet resets all changes to the "content_json_set" field.
func (m *EpicHeroInfoMutation) ResetContentJSONSet() {
m.content_json_set = nil
}
// SetUpdateTimeSet sets the "update_time_set" field.
func (m *EpicHeroInfoMutation) SetUpdateTimeSet(t time.Time) {
m.update_time_set = &t
}
// UpdateTimeSet returns the value of the "update_time_set" field in the mutation.
func (m *EpicHeroInfoMutation) UpdateTimeSet() (r time.Time, exists bool) {
v := m.update_time_set
if v == nil {
return
}
return *v, true
}
// OldUpdateTimeSet returns the old "update_time_set" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldUpdateTimeSet(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTimeSet is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTimeSet requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTimeSet: %w", err)
}
return oldValue.UpdateTimeSet, nil
}
// ClearUpdateTimeSet clears the value of the "update_time_set" field.
func (m *EpicHeroInfoMutation) ClearUpdateTimeSet() {
m.update_time_set = nil
m.clearedFields[epicheroinfo.FieldUpdateTimeSet] = struct{}{}
}
// UpdateTimeSetCleared returns if the "update_time_set" field was cleared in this mutation.
func (m *EpicHeroInfoMutation) UpdateTimeSetCleared() bool {
_, ok := m.clearedFields[epicheroinfo.FieldUpdateTimeSet]
return ok
}
// ResetUpdateTimeSet resets all changes to the "update_time_set" field.
func (m *EpicHeroInfoMutation) ResetUpdateTimeSet() {
m.update_time_set = nil
delete(m.clearedFields, epicheroinfo.FieldUpdateTimeSet)
}
// Where appends a list predicates to the EpicHeroInfoMutation builder.
func (m *EpicHeroInfoMutation) Where(ps ...predicate.EpicHeroInfo) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicHeroInfoMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicHeroInfoMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicHeroInfo, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicHeroInfoMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicHeroInfoMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicHeroInfo).
func (m *EpicHeroInfoMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicHeroInfoMutation) Fields() []string {
fields := make([]string, 0, 18)
if m.hero_name != nil {
fields = append(fields, epicheroinfo.FieldHeroName)
}
if m.hero_code != nil {
fields = append(fields, epicheroinfo.FieldHeroCode)
}
if m.hero_attr_lv60 != nil {
fields = append(fields, epicheroinfo.FieldHeroAttrLv60)
}
if m.creator != nil {
fields = append(fields, epicheroinfo.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicheroinfo.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicheroinfo.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicheroinfo.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicheroinfo.FieldDeleted)
}
if m.nick_name != nil {
fields = append(fields, epicheroinfo.FieldNickName)
}
if m.rarity != nil {
fields = append(fields, epicheroinfo.FieldRarity)
}
if m.role != nil {
fields = append(fields, epicheroinfo.FieldRole)
}
if m.zodiac != nil {
fields = append(fields, epicheroinfo.FieldZodiac)
}
if m.head_img_url != nil {
fields = append(fields, epicheroinfo.FieldHeadImgURL)
}
if m.attribute != nil {
fields = append(fields, epicheroinfo.FieldAttribute)
}
if m.remark != nil {
fields = append(fields, epicheroinfo.FieldRemark)
}
if m.raw_json != nil {
fields = append(fields, epicheroinfo.FieldRawJSON)
}
if m.content_json_set != nil {
fields = append(fields, epicheroinfo.FieldContentJSONSet)
}
if m.update_time_set != nil {
fields = append(fields, epicheroinfo.FieldUpdateTimeSet)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicHeroInfoMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicheroinfo.FieldHeroName:
return m.HeroName()
case epicheroinfo.FieldHeroCode:
return m.HeroCode()
case epicheroinfo.FieldHeroAttrLv60:
return m.HeroAttrLv60()
case epicheroinfo.FieldCreator:
return m.Creator()
case epicheroinfo.FieldCreateTime:
return m.CreateTime()
case epicheroinfo.FieldUpdater:
return m.Updater()
case epicheroinfo.FieldUpdateTime:
return m.UpdateTime()
case epicheroinfo.FieldDeleted:
return m.Deleted()
case epicheroinfo.FieldNickName:
return m.NickName()
case epicheroinfo.FieldRarity:
return m.Rarity()
case epicheroinfo.FieldRole:
return m.Role()
case epicheroinfo.FieldZodiac:
return m.Zodiac()
case epicheroinfo.FieldHeadImgURL:
return m.HeadImgURL()
case epicheroinfo.FieldAttribute:
return m.Attribute()
case epicheroinfo.FieldRemark:
return m.Remark()
case epicheroinfo.FieldRawJSON:
return m.RawJSON()
case epicheroinfo.FieldContentJSONSet:
return m.ContentJSONSet()
case epicheroinfo.FieldUpdateTimeSet:
return m.UpdateTimeSet()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicHeroInfoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicheroinfo.FieldHeroName:
return m.OldHeroName(ctx)
case epicheroinfo.FieldHeroCode:
return m.OldHeroCode(ctx)
case epicheroinfo.FieldHeroAttrLv60:
return m.OldHeroAttrLv60(ctx)
case epicheroinfo.FieldCreator:
return m.OldCreator(ctx)
case epicheroinfo.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicheroinfo.FieldUpdater:
return m.OldUpdater(ctx)
case epicheroinfo.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicheroinfo.FieldDeleted:
return m.OldDeleted(ctx)
case epicheroinfo.FieldNickName:
return m.OldNickName(ctx)
case epicheroinfo.FieldRarity:
return m.OldRarity(ctx)
case epicheroinfo.FieldRole:
return m.OldRole(ctx)
case epicheroinfo.FieldZodiac:
return m.OldZodiac(ctx)
case epicheroinfo.FieldHeadImgURL:
return m.OldHeadImgURL(ctx)
case epicheroinfo.FieldAttribute:
return m.OldAttribute(ctx)
case epicheroinfo.FieldRemark:
return m.OldRemark(ctx)
case epicheroinfo.FieldRawJSON:
return m.OldRawJSON(ctx)
case epicheroinfo.FieldContentJSONSet:
return m.OldContentJSONSet(ctx)
case epicheroinfo.FieldUpdateTimeSet:
return m.OldUpdateTimeSet(ctx)
}
return nil, fmt.Errorf("unknown EpicHeroInfo field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicHeroInfoMutation) SetField(name string, value ent.Value) error {
switch name {
case epicheroinfo.FieldHeroName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroName(v)
return nil
case epicheroinfo.FieldHeroCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroCode(v)
return nil
case epicheroinfo.FieldHeroAttrLv60:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroAttrLv60(v)
return nil
case epicheroinfo.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicheroinfo.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicheroinfo.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicheroinfo.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicheroinfo.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
case epicheroinfo.FieldNickName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetNickName(v)
return nil
case epicheroinfo.FieldRarity:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRarity(v)
return nil
case epicheroinfo.FieldRole:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRole(v)
return nil
case epicheroinfo.FieldZodiac:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetZodiac(v)
return nil
case epicheroinfo.FieldHeadImgURL:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeadImgURL(v)
return nil
case epicheroinfo.FieldAttribute:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAttribute(v)
return nil
case epicheroinfo.FieldRemark:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRemark(v)
return nil
case epicheroinfo.FieldRawJSON:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRawJSON(v)
return nil
case epicheroinfo.FieldContentJSONSet:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetContentJSONSet(v)
return nil
case epicheroinfo.FieldUpdateTimeSet:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTimeSet(v)
return nil
}
return fmt.Errorf("unknown EpicHeroInfo field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicHeroInfoMutation) AddedFields() []string {
return nil
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicHeroInfoMutation) AddedField(name string) (ent.Value, bool) {
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicHeroInfoMutation) AddField(name string, value ent.Value) error {
switch name {
}
return fmt.Errorf("unknown EpicHeroInfo numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicHeroInfoMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicheroinfo.FieldCreateTime) {
fields = append(fields, epicheroinfo.FieldCreateTime)
}
if m.FieldCleared(epicheroinfo.FieldUpdateTime) {
fields = append(fields, epicheroinfo.FieldUpdateTime)
}
if m.FieldCleared(epicheroinfo.FieldUpdateTimeSet) {
fields = append(fields, epicheroinfo.FieldUpdateTimeSet)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicHeroInfoMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicHeroInfoMutation) ClearField(name string) error {
switch name {
case epicheroinfo.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicheroinfo.FieldUpdateTime:
m.ClearUpdateTime()
return nil
case epicheroinfo.FieldUpdateTimeSet:
m.ClearUpdateTimeSet()
return nil
}
return fmt.Errorf("unknown EpicHeroInfo nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicHeroInfoMutation) ResetField(name string) error {
switch name {
case epicheroinfo.FieldHeroName:
m.ResetHeroName()
return nil
case epicheroinfo.FieldHeroCode:
m.ResetHeroCode()
return nil
case epicheroinfo.FieldHeroAttrLv60:
m.ResetHeroAttrLv60()
return nil
case epicheroinfo.FieldCreator:
m.ResetCreator()
return nil
case epicheroinfo.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicheroinfo.FieldUpdater:
m.ResetUpdater()
return nil
case epicheroinfo.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicheroinfo.FieldDeleted:
m.ResetDeleted()
return nil
case epicheroinfo.FieldNickName:
m.ResetNickName()
return nil
case epicheroinfo.FieldRarity:
m.ResetRarity()
return nil
case epicheroinfo.FieldRole:
m.ResetRole()
return nil
case epicheroinfo.FieldZodiac:
m.ResetZodiac()
return nil
case epicheroinfo.FieldHeadImgURL:
m.ResetHeadImgURL()
return nil
case epicheroinfo.FieldAttribute:
m.ResetAttribute()
return nil
case epicheroinfo.FieldRemark:
m.ResetRemark()
return nil
case epicheroinfo.FieldRawJSON:
m.ResetRawJSON()
return nil
case epicheroinfo.FieldContentJSONSet:
m.ResetContentJSONSet()
return nil
case epicheroinfo.FieldUpdateTimeSet:
m.ResetUpdateTimeSet()
return nil
}
return fmt.Errorf("unknown EpicHeroInfo field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicHeroInfoMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicHeroInfoMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicHeroInfoMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicHeroInfoMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicHeroInfoMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicHeroInfoMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicHeroInfoMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicHeroInfo unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicHeroInfoMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicHeroInfo edge %s", name)
}
// EpicHeroUserBuildMutation represents an operation that mutates the EpicHeroUserBuild nodes in the graph.
type EpicHeroUserBuildMutation struct {
config
op Op
typ string
id *int64
artifact_code *string
hero_code *string
hero_heath_build *float64
addhero_heath_build *float64
hero_attack_build *float64
addhero_attack_build *float64
hero_def_build *float64
addhero_def_build *float64
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicHeroUserBuild, error)
predicates []predicate.EpicHeroUserBuild
}
var _ ent.Mutation = (*EpicHeroUserBuildMutation)(nil)
// epicherouserbuildOption allows management of the mutation configuration using functional options.
type epicherouserbuildOption func(*EpicHeroUserBuildMutation)
// newEpicHeroUserBuildMutation creates new mutation for the EpicHeroUserBuild entity.
func newEpicHeroUserBuildMutation(c config, op Op, opts ...epicherouserbuildOption) *EpicHeroUserBuildMutation {
m := &EpicHeroUserBuildMutation{
config: c,
op: op,
typ: TypeEpicHeroUserBuild,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicHeroUserBuildID sets the ID field of the mutation.
func withEpicHeroUserBuildID(id int64) epicherouserbuildOption {
return func(m *EpicHeroUserBuildMutation) {
var (
err error
once sync.Once
value *EpicHeroUserBuild
)
m.oldValue = func(ctx context.Context) (*EpicHeroUserBuild, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicHeroUserBuild.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicHeroUserBuild sets the old EpicHeroUserBuild of the mutation.
func withEpicHeroUserBuild(node *EpicHeroUserBuild) epicherouserbuildOption {
return func(m *EpicHeroUserBuildMutation) {
m.oldValue = func(context.Context) (*EpicHeroUserBuild, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicHeroUserBuildMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicHeroUserBuildMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicHeroUserBuild entities.
func (m *EpicHeroUserBuildMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicHeroUserBuildMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicHeroUserBuildMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicHeroUserBuild.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetArtifactCode sets the "artifact_code" field.
func (m *EpicHeroUserBuildMutation) SetArtifactCode(s string) {
m.artifact_code = &s
}
// ArtifactCode returns the value of the "artifact_code" field in the mutation.
func (m *EpicHeroUserBuildMutation) ArtifactCode() (r string, exists bool) {
v := m.artifact_code
if v == nil {
return
}
return *v, true
}
// OldArtifactCode returns the old "artifact_code" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldArtifactCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldArtifactCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldArtifactCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldArtifactCode: %w", err)
}
return oldValue.ArtifactCode, nil
}
// ResetArtifactCode resets all changes to the "artifact_code" field.
func (m *EpicHeroUserBuildMutation) ResetArtifactCode() {
m.artifact_code = nil
}
// SetHeroCode sets the "hero_code" field.
func (m *EpicHeroUserBuildMutation) SetHeroCode(s string) {
m.hero_code = &s
}
// HeroCode returns the value of the "hero_code" field in the mutation.
func (m *EpicHeroUserBuildMutation) HeroCode() (r string, exists bool) {
v := m.hero_code
if v == nil {
return
}
return *v, true
}
// OldHeroCode returns the old "hero_code" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldHeroCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroCode: %w", err)
}
return oldValue.HeroCode, nil
}
// ResetHeroCode resets all changes to the "hero_code" field.
func (m *EpicHeroUserBuildMutation) ResetHeroCode() {
m.hero_code = nil
}
// SetHeroHeathBuild sets the "hero_heath_build" field.
func (m *EpicHeroUserBuildMutation) SetHeroHeathBuild(f float64) {
m.hero_heath_build = &f
m.addhero_heath_build = nil
}
// HeroHeathBuild returns the value of the "hero_heath_build" field in the mutation.
func (m *EpicHeroUserBuildMutation) HeroHeathBuild() (r float64, exists bool) {
v := m.hero_heath_build
if v == nil {
return
}
return *v, true
}
// OldHeroHeathBuild returns the old "hero_heath_build" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldHeroHeathBuild(ctx context.Context) (v float64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroHeathBuild is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroHeathBuild requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroHeathBuild: %w", err)
}
return oldValue.HeroHeathBuild, nil
}
// AddHeroHeathBuild adds f to the "hero_heath_build" field.
func (m *EpicHeroUserBuildMutation) AddHeroHeathBuild(f float64) {
if m.addhero_heath_build != nil {
*m.addhero_heath_build += f
} else {
m.addhero_heath_build = &f
}
}
// AddedHeroHeathBuild returns the value that was added to the "hero_heath_build" field in this mutation.
func (m *EpicHeroUserBuildMutation) AddedHeroHeathBuild() (r float64, exists bool) {
v := m.addhero_heath_build
if v == nil {
return
}
return *v, true
}
// ResetHeroHeathBuild resets all changes to the "hero_heath_build" field.
func (m *EpicHeroUserBuildMutation) ResetHeroHeathBuild() {
m.hero_heath_build = nil
m.addhero_heath_build = nil
}
// SetHeroAttackBuild sets the "hero_attack_build" field.
func (m *EpicHeroUserBuildMutation) SetHeroAttackBuild(f float64) {
m.hero_attack_build = &f
m.addhero_attack_build = nil
}
// HeroAttackBuild returns the value of the "hero_attack_build" field in the mutation.
func (m *EpicHeroUserBuildMutation) HeroAttackBuild() (r float64, exists bool) {
v := m.hero_attack_build
if v == nil {
return
}
return *v, true
}
// OldHeroAttackBuild returns the old "hero_attack_build" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldHeroAttackBuild(ctx context.Context) (v float64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroAttackBuild is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroAttackBuild requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroAttackBuild: %w", err)
}
return oldValue.HeroAttackBuild, nil
}
// AddHeroAttackBuild adds f to the "hero_attack_build" field.
func (m *EpicHeroUserBuildMutation) AddHeroAttackBuild(f float64) {
if m.addhero_attack_build != nil {
*m.addhero_attack_build += f
} else {
m.addhero_attack_build = &f
}
}
// AddedHeroAttackBuild returns the value that was added to the "hero_attack_build" field in this mutation.
func (m *EpicHeroUserBuildMutation) AddedHeroAttackBuild() (r float64, exists bool) {
v := m.addhero_attack_build
if v == nil {
return
}
return *v, true
}
// ResetHeroAttackBuild resets all changes to the "hero_attack_build" field.
func (m *EpicHeroUserBuildMutation) ResetHeroAttackBuild() {
m.hero_attack_build = nil
m.addhero_attack_build = nil
}
// SetHeroDefBuild sets the "hero_def_build" field.
func (m *EpicHeroUserBuildMutation) SetHeroDefBuild(f float64) {
m.hero_def_build = &f
m.addhero_def_build = nil
}
// HeroDefBuild returns the value of the "hero_def_build" field in the mutation.
func (m *EpicHeroUserBuildMutation) HeroDefBuild() (r float64, exists bool) {
v := m.hero_def_build
if v == nil {
return
}
return *v, true
}
// OldHeroDefBuild returns the old "hero_def_build" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldHeroDefBuild(ctx context.Context) (v float64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroDefBuild is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroDefBuild requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroDefBuild: %w", err)
}
return oldValue.HeroDefBuild, nil
}
// AddHeroDefBuild adds f to the "hero_def_build" field.
func (m *EpicHeroUserBuildMutation) AddHeroDefBuild(f float64) {
if m.addhero_def_build != nil {
*m.addhero_def_build += f
} else {
m.addhero_def_build = &f
}
}
// AddedHeroDefBuild returns the value that was added to the "hero_def_build" field in this mutation.
func (m *EpicHeroUserBuildMutation) AddedHeroDefBuild() (r float64, exists bool) {
v := m.addhero_def_build
if v == nil {
return
}
return *v, true
}
// ResetHeroDefBuild resets all changes to the "hero_def_build" field.
func (m *EpicHeroUserBuildMutation) ResetHeroDefBuild() {
m.hero_def_build = nil
m.addhero_def_build = nil
}
// SetCreator sets the "creator" field.
func (m *EpicHeroUserBuildMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicHeroUserBuildMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicHeroUserBuildMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicHeroUserBuildMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicHeroUserBuildMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicHeroUserBuildMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epicherouserbuild.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicHeroUserBuildMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epicherouserbuild.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicHeroUserBuildMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epicherouserbuild.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicHeroUserBuildMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicHeroUserBuildMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicHeroUserBuildMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicHeroUserBuildMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicHeroUserBuildMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicHeroUserBuildMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epicherouserbuild.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicHeroUserBuildMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epicherouserbuild.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicHeroUserBuildMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epicherouserbuild.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicHeroUserBuildMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicHeroUserBuildMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicHeroUserBuild entity.
// If the EpicHeroUserBuild object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroUserBuildMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicHeroUserBuildMutation) ResetDeleted() {
m.deleted = nil
}
// Where appends a list predicates to the EpicHeroUserBuildMutation builder.
func (m *EpicHeroUserBuildMutation) Where(ps ...predicate.EpicHeroUserBuild) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicHeroUserBuildMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicHeroUserBuildMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicHeroUserBuild, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicHeroUserBuildMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicHeroUserBuildMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicHeroUserBuild).
func (m *EpicHeroUserBuildMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicHeroUserBuildMutation) Fields() []string {
fields := make([]string, 0, 10)
if m.artifact_code != nil {
fields = append(fields, epicherouserbuild.FieldArtifactCode)
}
if m.hero_code != nil {
fields = append(fields, epicherouserbuild.FieldHeroCode)
}
if m.hero_heath_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroHeathBuild)
}
if m.hero_attack_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroAttackBuild)
}
if m.hero_def_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroDefBuild)
}
if m.creator != nil {
fields = append(fields, epicherouserbuild.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epicherouserbuild.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epicherouserbuild.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epicherouserbuild.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epicherouserbuild.FieldDeleted)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicHeroUserBuildMutation) Field(name string) (ent.Value, bool) {
switch name {
case epicherouserbuild.FieldArtifactCode:
return m.ArtifactCode()
case epicherouserbuild.FieldHeroCode:
return m.HeroCode()
case epicherouserbuild.FieldHeroHeathBuild:
return m.HeroHeathBuild()
case epicherouserbuild.FieldHeroAttackBuild:
return m.HeroAttackBuild()
case epicherouserbuild.FieldHeroDefBuild:
return m.HeroDefBuild()
case epicherouserbuild.FieldCreator:
return m.Creator()
case epicherouserbuild.FieldCreateTime:
return m.CreateTime()
case epicherouserbuild.FieldUpdater:
return m.Updater()
case epicherouserbuild.FieldUpdateTime:
return m.UpdateTime()
case epicherouserbuild.FieldDeleted:
return m.Deleted()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicHeroUserBuildMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epicherouserbuild.FieldArtifactCode:
return m.OldArtifactCode(ctx)
case epicherouserbuild.FieldHeroCode:
return m.OldHeroCode(ctx)
case epicherouserbuild.FieldHeroHeathBuild:
return m.OldHeroHeathBuild(ctx)
case epicherouserbuild.FieldHeroAttackBuild:
return m.OldHeroAttackBuild(ctx)
case epicherouserbuild.FieldHeroDefBuild:
return m.OldHeroDefBuild(ctx)
case epicherouserbuild.FieldCreator:
return m.OldCreator(ctx)
case epicherouserbuild.FieldCreateTime:
return m.OldCreateTime(ctx)
case epicherouserbuild.FieldUpdater:
return m.OldUpdater(ctx)
case epicherouserbuild.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epicherouserbuild.FieldDeleted:
return m.OldDeleted(ctx)
}
return nil, fmt.Errorf("unknown EpicHeroUserBuild field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicHeroUserBuildMutation) SetField(name string, value ent.Value) error {
switch name {
case epicherouserbuild.FieldArtifactCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetArtifactCode(v)
return nil
case epicherouserbuild.FieldHeroCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroCode(v)
return nil
case epicherouserbuild.FieldHeroHeathBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroHeathBuild(v)
return nil
case epicherouserbuild.FieldHeroAttackBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroAttackBuild(v)
return nil
case epicherouserbuild.FieldHeroDefBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroDefBuild(v)
return nil
case epicherouserbuild.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epicherouserbuild.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epicherouserbuild.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epicherouserbuild.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epicherouserbuild.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
}
return fmt.Errorf("unknown EpicHeroUserBuild field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicHeroUserBuildMutation) AddedFields() []string {
var fields []string
if m.addhero_heath_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroHeathBuild)
}
if m.addhero_attack_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroAttackBuild)
}
if m.addhero_def_build != nil {
fields = append(fields, epicherouserbuild.FieldHeroDefBuild)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicHeroUserBuildMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case epicherouserbuild.FieldHeroHeathBuild:
return m.AddedHeroHeathBuild()
case epicherouserbuild.FieldHeroAttackBuild:
return m.AddedHeroAttackBuild()
case epicherouserbuild.FieldHeroDefBuild:
return m.AddedHeroDefBuild()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicHeroUserBuildMutation) AddField(name string, value ent.Value) error {
switch name {
case epicherouserbuild.FieldHeroHeathBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddHeroHeathBuild(v)
return nil
case epicherouserbuild.FieldHeroAttackBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddHeroAttackBuild(v)
return nil
case epicherouserbuild.FieldHeroDefBuild:
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddHeroDefBuild(v)
return nil
}
return fmt.Errorf("unknown EpicHeroUserBuild numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicHeroUserBuildMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epicherouserbuild.FieldCreateTime) {
fields = append(fields, epicherouserbuild.FieldCreateTime)
}
if m.FieldCleared(epicherouserbuild.FieldUpdateTime) {
fields = append(fields, epicherouserbuild.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicHeroUserBuildMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicHeroUserBuildMutation) ClearField(name string) error {
switch name {
case epicherouserbuild.FieldCreateTime:
m.ClearCreateTime()
return nil
case epicherouserbuild.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicHeroUserBuild nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicHeroUserBuildMutation) ResetField(name string) error {
switch name {
case epicherouserbuild.FieldArtifactCode:
m.ResetArtifactCode()
return nil
case epicherouserbuild.FieldHeroCode:
m.ResetHeroCode()
return nil
case epicherouserbuild.FieldHeroHeathBuild:
m.ResetHeroHeathBuild()
return nil
case epicherouserbuild.FieldHeroAttackBuild:
m.ResetHeroAttackBuild()
return nil
case epicherouserbuild.FieldHeroDefBuild:
m.ResetHeroDefBuild()
return nil
case epicherouserbuild.FieldCreator:
m.ResetCreator()
return nil
case epicherouserbuild.FieldCreateTime:
m.ResetCreateTime()
return nil
case epicherouserbuild.FieldUpdater:
m.ResetUpdater()
return nil
case epicherouserbuild.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epicherouserbuild.FieldDeleted:
m.ResetDeleted()
return nil
}
return fmt.Errorf("unknown EpicHeroUserBuild field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicHeroUserBuildMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicHeroUserBuildMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicHeroUserBuildMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicHeroUserBuildMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicHeroUserBuildMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicHeroUserBuildMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicHeroUserBuildMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicHeroUserBuild unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicHeroUserBuildMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicHeroUserBuild edge %s", name)
}
// EpicI18NMappingsMutation represents an operation that mutates the EpicI18NMappings nodes in the graph.
type EpicI18NMappingsMutation struct {
config
op Op
typ string
id *int64
key_name *string
language *string
value *string
category *string
status *int
addstatus *int
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *int
adddeleted *int
code *string
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicI18NMappings, error)
predicates []predicate.EpicI18NMappings
}
var _ ent.Mutation = (*EpicI18NMappingsMutation)(nil)
// epici18nmappingsOption allows management of the mutation configuration using functional options.
type epici18nmappingsOption func(*EpicI18NMappingsMutation)
// newEpicI18NMappingsMutation creates new mutation for the EpicI18NMappings entity.
func newEpicI18NMappingsMutation(c config, op Op, opts ...epici18nmappingsOption) *EpicI18NMappingsMutation {
m := &EpicI18NMappingsMutation{
config: c,
op: op,
typ: TypeEpicI18NMappings,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withEpicI18NMappingsID sets the ID field of the mutation.
func withEpicI18NMappingsID(id int64) epici18nmappingsOption {
return func(m *EpicI18NMappingsMutation) {
var (
err error
once sync.Once
value *EpicI18NMappings
)
m.oldValue = func(ctx context.Context) (*EpicI18NMappings, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().EpicI18NMappings.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withEpicI18NMappings sets the old EpicI18NMappings of the mutation.
func withEpicI18NMappings(node *EpicI18NMappings) epici18nmappingsOption {
return func(m *EpicI18NMappingsMutation) {
m.oldValue = func(context.Context) (*EpicI18NMappings, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m EpicI18NMappingsMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m EpicI18NMappingsMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of EpicI18NMappings entities.
func (m *EpicI18NMappingsMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *EpicI18NMappingsMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *EpicI18NMappingsMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().EpicI18NMappings.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetKeyName sets the "key_name" field.
func (m *EpicI18NMappingsMutation) SetKeyName(s string) {
m.key_name = &s
}
// KeyName returns the value of the "key_name" field in the mutation.
func (m *EpicI18NMappingsMutation) KeyName() (r string, exists bool) {
v := m.key_name
if v == nil {
return
}
return *v, true
}
// OldKeyName returns the old "key_name" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldKeyName(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldKeyName is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldKeyName requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldKeyName: %w", err)
}
return oldValue.KeyName, nil
}
// ResetKeyName resets all changes to the "key_name" field.
func (m *EpicI18NMappingsMutation) ResetKeyName() {
m.key_name = nil
}
// SetLanguage sets the "language" field.
func (m *EpicI18NMappingsMutation) SetLanguage(s string) {
m.language = &s
}
// Language returns the value of the "language" field in the mutation.
func (m *EpicI18NMappingsMutation) Language() (r string, exists bool) {
v := m.language
if v == nil {
return
}
return *v, true
}
// OldLanguage returns the old "language" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldLanguage(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldLanguage is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldLanguage requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldLanguage: %w", err)
}
return oldValue.Language, nil
}
// ResetLanguage resets all changes to the "language" field.
func (m *EpicI18NMappingsMutation) ResetLanguage() {
m.language = nil
}
// SetValue sets the "value" field.
func (m *EpicI18NMappingsMutation) SetValue(s string) {
m.value = &s
}
// Value returns the value of the "value" field in the mutation.
func (m *EpicI18NMappingsMutation) Value() (r string, exists bool) {
v := m.value
if v == nil {
return
}
return *v, true
}
// OldValue returns the old "value" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldValue(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldValue: %w", err)
}
return oldValue.Value, nil
}
// ResetValue resets all changes to the "value" field.
func (m *EpicI18NMappingsMutation) ResetValue() {
m.value = nil
}
// SetCategory sets the "category" field.
func (m *EpicI18NMappingsMutation) SetCategory(s string) {
m.category = &s
}
// Category returns the value of the "category" field in the mutation.
func (m *EpicI18NMappingsMutation) Category() (r string, exists bool) {
v := m.category
if v == nil {
return
}
return *v, true
}
// OldCategory returns the old "category" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldCategory(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCategory is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCategory requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCategory: %w", err)
}
return oldValue.Category, nil
}
// ResetCategory resets all changes to the "category" field.
func (m *EpicI18NMappingsMutation) ResetCategory() {
m.category = nil
}
// SetStatus sets the "status" field.
func (m *EpicI18NMappingsMutation) SetStatus(i int) {
m.status = &i
m.addstatus = nil
}
// Status returns the value of the "status" field in the mutation.
func (m *EpicI18NMappingsMutation) Status() (r int, exists bool) {
v := m.status
if v == nil {
return
}
return *v, true
}
// OldStatus returns the old "status" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldStatus(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldStatus is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldStatus requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldStatus: %w", err)
}
return oldValue.Status, nil
}
// AddStatus adds i to the "status" field.
func (m *EpicI18NMappingsMutation) AddStatus(i int) {
if m.addstatus != nil {
*m.addstatus += i
} else {
m.addstatus = &i
}
}
// AddedStatus returns the value that was added to the "status" field in this mutation.
func (m *EpicI18NMappingsMutation) AddedStatus() (r int, exists bool) {
v := m.addstatus
if v == nil {
return
}
return *v, true
}
// ResetStatus resets all changes to the "status" field.
func (m *EpicI18NMappingsMutation) ResetStatus() {
m.status = nil
m.addstatus = nil
}
// SetCreator sets the "creator" field.
func (m *EpicI18NMappingsMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *EpicI18NMappingsMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *EpicI18NMappingsMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *EpicI18NMappingsMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *EpicI18NMappingsMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *EpicI18NMappingsMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[epici18nmappings.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *EpicI18NMappingsMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[epici18nmappings.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *EpicI18NMappingsMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, epici18nmappings.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *EpicI18NMappingsMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *EpicI18NMappingsMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *EpicI18NMappingsMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *EpicI18NMappingsMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *EpicI18NMappingsMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *EpicI18NMappingsMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[epici18nmappings.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *EpicI18NMappingsMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[epici18nmappings.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *EpicI18NMappingsMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, epici18nmappings.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *EpicI18NMappingsMutation) SetDeleted(i int) {
m.deleted = &i
m.adddeleted = nil
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *EpicI18NMappingsMutation) Deleted() (r int, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldDeleted(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// AddDeleted adds i to the "deleted" field.
func (m *EpicI18NMappingsMutation) AddDeleted(i int) {
if m.adddeleted != nil {
*m.adddeleted += i
} else {
m.adddeleted = &i
}
}
// AddedDeleted returns the value that was added to the "deleted" field in this mutation.
func (m *EpicI18NMappingsMutation) AddedDeleted() (r int, exists bool) {
v := m.adddeleted
if v == nil {
return
}
return *v, true
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *EpicI18NMappingsMutation) ResetDeleted() {
m.deleted = nil
m.adddeleted = nil
}
// SetCode sets the "code" field.
func (m *EpicI18NMappingsMutation) SetCode(s string) {
m.code = &s
}
// Code returns the value of the "code" field in the mutation.
func (m *EpicI18NMappingsMutation) Code() (r string, exists bool) {
v := m.code
if v == nil {
return
}
return *v, true
}
// OldCode returns the old "code" field's value of the EpicI18NMappings entity.
// If the EpicI18NMappings object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicI18NMappingsMutation) OldCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCode: %w", err)
}
return oldValue.Code, nil
}
// ResetCode resets all changes to the "code" field.
func (m *EpicI18NMappingsMutation) ResetCode() {
m.code = nil
}
// Where appends a list predicates to the EpicI18NMappingsMutation builder.
func (m *EpicI18NMappingsMutation) Where(ps ...predicate.EpicI18NMappings) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the EpicI18NMappingsMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *EpicI18NMappingsMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.EpicI18NMappings, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *EpicI18NMappingsMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *EpicI18NMappingsMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (EpicI18NMappings).
func (m *EpicI18NMappingsMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *EpicI18NMappingsMutation) Fields() []string {
fields := make([]string, 0, 11)
if m.key_name != nil {
fields = append(fields, epici18nmappings.FieldKeyName)
}
if m.language != nil {
fields = append(fields, epici18nmappings.FieldLanguage)
}
if m.value != nil {
fields = append(fields, epici18nmappings.FieldValue)
}
if m.category != nil {
fields = append(fields, epici18nmappings.FieldCategory)
}
if m.status != nil {
fields = append(fields, epici18nmappings.FieldStatus)
}
if m.creator != nil {
fields = append(fields, epici18nmappings.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, epici18nmappings.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, epici18nmappings.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, epici18nmappings.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, epici18nmappings.FieldDeleted)
}
if m.code != nil {
fields = append(fields, epici18nmappings.FieldCode)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *EpicI18NMappingsMutation) Field(name string) (ent.Value, bool) {
switch name {
case epici18nmappings.FieldKeyName:
return m.KeyName()
case epici18nmappings.FieldLanguage:
return m.Language()
case epici18nmappings.FieldValue:
return m.Value()
case epici18nmappings.FieldCategory:
return m.Category()
case epici18nmappings.FieldStatus:
return m.Status()
case epici18nmappings.FieldCreator:
return m.Creator()
case epici18nmappings.FieldCreateTime:
return m.CreateTime()
case epici18nmappings.FieldUpdater:
return m.Updater()
case epici18nmappings.FieldUpdateTime:
return m.UpdateTime()
case epici18nmappings.FieldDeleted:
return m.Deleted()
case epici18nmappings.FieldCode:
return m.Code()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *EpicI18NMappingsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case epici18nmappings.FieldKeyName:
return m.OldKeyName(ctx)
case epici18nmappings.FieldLanguage:
return m.OldLanguage(ctx)
case epici18nmappings.FieldValue:
return m.OldValue(ctx)
case epici18nmappings.FieldCategory:
return m.OldCategory(ctx)
case epici18nmappings.FieldStatus:
return m.OldStatus(ctx)
case epici18nmappings.FieldCreator:
return m.OldCreator(ctx)
case epici18nmappings.FieldCreateTime:
return m.OldCreateTime(ctx)
case epici18nmappings.FieldUpdater:
return m.OldUpdater(ctx)
case epici18nmappings.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case epici18nmappings.FieldDeleted:
return m.OldDeleted(ctx)
case epici18nmappings.FieldCode:
return m.OldCode(ctx)
}
return nil, fmt.Errorf("unknown EpicI18NMappings field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicI18NMappingsMutation) SetField(name string, value ent.Value) error {
switch name {
case epici18nmappings.FieldKeyName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetKeyName(v)
return nil
case epici18nmappings.FieldLanguage:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetLanguage(v)
return nil
case epici18nmappings.FieldValue:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetValue(v)
return nil
case epici18nmappings.FieldCategory:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCategory(v)
return nil
case epici18nmappings.FieldStatus:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStatus(v)
return nil
case epici18nmappings.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case epici18nmappings.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case epici18nmappings.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case epici18nmappings.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case epici18nmappings.FieldDeleted:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
case epici18nmappings.FieldCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCode(v)
return nil
}
return fmt.Errorf("unknown EpicI18NMappings field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *EpicI18NMappingsMutation) AddedFields() []string {
var fields []string
if m.addstatus != nil {
fields = append(fields, epici18nmappings.FieldStatus)
}
if m.adddeleted != nil {
fields = append(fields, epici18nmappings.FieldDeleted)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *EpicI18NMappingsMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case epici18nmappings.FieldStatus:
return m.AddedStatus()
case epici18nmappings.FieldDeleted:
return m.AddedDeleted()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *EpicI18NMappingsMutation) AddField(name string, value ent.Value) error {
switch name {
case epici18nmappings.FieldStatus:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddStatus(v)
return nil
case epici18nmappings.FieldDeleted:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddDeleted(v)
return nil
}
return fmt.Errorf("unknown EpicI18NMappings numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *EpicI18NMappingsMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(epici18nmappings.FieldCreateTime) {
fields = append(fields, epici18nmappings.FieldCreateTime)
}
if m.FieldCleared(epici18nmappings.FieldUpdateTime) {
fields = append(fields, epici18nmappings.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *EpicI18NMappingsMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *EpicI18NMappingsMutation) ClearField(name string) error {
switch name {
case epici18nmappings.FieldCreateTime:
m.ClearCreateTime()
return nil
case epici18nmappings.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown EpicI18NMappings nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *EpicI18NMappingsMutation) ResetField(name string) error {
switch name {
case epici18nmappings.FieldKeyName:
m.ResetKeyName()
return nil
case epici18nmappings.FieldLanguage:
m.ResetLanguage()
return nil
case epici18nmappings.FieldValue:
m.ResetValue()
return nil
case epici18nmappings.FieldCategory:
m.ResetCategory()
return nil
case epici18nmappings.FieldStatus:
m.ResetStatus()
return nil
case epici18nmappings.FieldCreator:
m.ResetCreator()
return nil
case epici18nmappings.FieldCreateTime:
m.ResetCreateTime()
return nil
case epici18nmappings.FieldUpdater:
m.ResetUpdater()
return nil
case epici18nmappings.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case epici18nmappings.FieldDeleted:
m.ResetDeleted()
return nil
case epici18nmappings.FieldCode:
m.ResetCode()
return nil
}
return fmt.Errorf("unknown EpicI18NMappings field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *EpicI18NMappingsMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *EpicI18NMappingsMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *EpicI18NMappingsMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *EpicI18NMappingsMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *EpicI18NMappingsMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *EpicI18NMappingsMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *EpicI18NMappingsMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown EpicI18NMappings unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *EpicI18NMappingsMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown EpicI18NMappings edge %s", name)
}
// FribbleHeroSetMutation represents an operation that mutates the FribbleHeroSet nodes in the graph.
type FribbleHeroSetMutation struct {
config
op Op
typ string
id *int64
hero_code *string
json_content *string
hero_name *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
success_get *int
addsuccess_get *int
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*FribbleHeroSet, error)
predicates []predicate.FribbleHeroSet
}
var _ ent.Mutation = (*FribbleHeroSetMutation)(nil)
// fribbleherosetOption allows management of the mutation configuration using functional options.
type fribbleherosetOption func(*FribbleHeroSetMutation)
// newFribbleHeroSetMutation creates new mutation for the FribbleHeroSet entity.
func newFribbleHeroSetMutation(c config, op Op, opts ...fribbleherosetOption) *FribbleHeroSetMutation {
m := &FribbleHeroSetMutation{
config: c,
op: op,
typ: TypeFribbleHeroSet,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withFribbleHeroSetID sets the ID field of the mutation.
func withFribbleHeroSetID(id int64) fribbleherosetOption {
return func(m *FribbleHeroSetMutation) {
var (
err error
once sync.Once
value *FribbleHeroSet
)
m.oldValue = func(ctx context.Context) (*FribbleHeroSet, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().FribbleHeroSet.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withFribbleHeroSet sets the old FribbleHeroSet of the mutation.
func withFribbleHeroSet(node *FribbleHeroSet) fribbleherosetOption {
return func(m *FribbleHeroSetMutation) {
m.oldValue = func(context.Context) (*FribbleHeroSet, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m FribbleHeroSetMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m FribbleHeroSetMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of FribbleHeroSet entities.
func (m *FribbleHeroSetMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *FribbleHeroSetMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *FribbleHeroSetMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().FribbleHeroSet.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetHeroCode sets the "hero_code" field.
func (m *FribbleHeroSetMutation) SetHeroCode(s string) {
m.hero_code = &s
}
// HeroCode returns the value of the "hero_code" field in the mutation.
func (m *FribbleHeroSetMutation) HeroCode() (r string, exists bool) {
v := m.hero_code
if v == nil {
return
}
return *v, true
}
// OldHeroCode returns the old "hero_code" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldHeroCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroCode: %w", err)
}
return oldValue.HeroCode, nil
}
// ResetHeroCode resets all changes to the "hero_code" field.
func (m *FribbleHeroSetMutation) ResetHeroCode() {
m.hero_code = nil
}
// SetJSONContent sets the "json_content" field.
func (m *FribbleHeroSetMutation) SetJSONContent(s string) {
m.json_content = &s
}
// JSONContent returns the value of the "json_content" field in the mutation.
func (m *FribbleHeroSetMutation) JSONContent() (r string, exists bool) {
v := m.json_content
if v == nil {
return
}
return *v, true
}
// OldJSONContent returns the old "json_content" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldJSONContent(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldJSONContent is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldJSONContent requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldJSONContent: %w", err)
}
return oldValue.JSONContent, nil
}
// ResetJSONContent resets all changes to the "json_content" field.
func (m *FribbleHeroSetMutation) ResetJSONContent() {
m.json_content = nil
}
// SetHeroName sets the "hero_name" field.
func (m *FribbleHeroSetMutation) SetHeroName(s string) {
m.hero_name = &s
}
// HeroName returns the value of the "hero_name" field in the mutation.
func (m *FribbleHeroSetMutation) HeroName() (r string, exists bool) {
v := m.hero_name
if v == nil {
return
}
return *v, true
}
// OldHeroName returns the old "hero_name" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldHeroName(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldHeroName is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldHeroName requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldHeroName: %w", err)
}
return oldValue.HeroName, nil
}
// ResetHeroName resets all changes to the "hero_name" field.
func (m *FribbleHeroSetMutation) ResetHeroName() {
m.hero_name = nil
}
// SetCreator sets the "creator" field.
func (m *FribbleHeroSetMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *FribbleHeroSetMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *FribbleHeroSetMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *FribbleHeroSetMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *FribbleHeroSetMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *FribbleHeroSetMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[fribbleheroset.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *FribbleHeroSetMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[fribbleheroset.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *FribbleHeroSetMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, fribbleheroset.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *FribbleHeroSetMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *FribbleHeroSetMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *FribbleHeroSetMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *FribbleHeroSetMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *FribbleHeroSetMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *FribbleHeroSetMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[fribbleheroset.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *FribbleHeroSetMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[fribbleheroset.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *FribbleHeroSetMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, fribbleheroset.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *FribbleHeroSetMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *FribbleHeroSetMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *FribbleHeroSetMutation) ResetDeleted() {
m.deleted = nil
}
// SetSuccessGet sets the "success_get" field.
func (m *FribbleHeroSetMutation) SetSuccessGet(i int) {
m.success_get = &i
m.addsuccess_get = nil
}
// SuccessGet returns the value of the "success_get" field in the mutation.
func (m *FribbleHeroSetMutation) SuccessGet() (r int, exists bool) {
v := m.success_get
if v == nil {
return
}
return *v, true
}
// OldSuccessGet returns the old "success_get" field's value of the FribbleHeroSet entity.
// If the FribbleHeroSet object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *FribbleHeroSetMutation) OldSuccessGet(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSuccessGet is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSuccessGet requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSuccessGet: %w", err)
}
return oldValue.SuccessGet, nil
}
// AddSuccessGet adds i to the "success_get" field.
func (m *FribbleHeroSetMutation) AddSuccessGet(i int) {
if m.addsuccess_get != nil {
*m.addsuccess_get += i
} else {
m.addsuccess_get = &i
}
}
// AddedSuccessGet returns the value that was added to the "success_get" field in this mutation.
func (m *FribbleHeroSetMutation) AddedSuccessGet() (r int, exists bool) {
v := m.addsuccess_get
if v == nil {
return
}
return *v, true
}
// ResetSuccessGet resets all changes to the "success_get" field.
func (m *FribbleHeroSetMutation) ResetSuccessGet() {
m.success_get = nil
m.addsuccess_get = nil
}
// Where appends a list predicates to the FribbleHeroSetMutation builder.
func (m *FribbleHeroSetMutation) Where(ps ...predicate.FribbleHeroSet) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the FribbleHeroSetMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *FribbleHeroSetMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.FribbleHeroSet, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *FribbleHeroSetMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *FribbleHeroSetMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (FribbleHeroSet).
func (m *FribbleHeroSetMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *FribbleHeroSetMutation) Fields() []string {
fields := make([]string, 0, 9)
if m.hero_code != nil {
fields = append(fields, fribbleheroset.FieldHeroCode)
}
if m.json_content != nil {
fields = append(fields, fribbleheroset.FieldJSONContent)
}
if m.hero_name != nil {
fields = append(fields, fribbleheroset.FieldHeroName)
}
if m.creator != nil {
fields = append(fields, fribbleheroset.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, fribbleheroset.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, fribbleheroset.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, fribbleheroset.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, fribbleheroset.FieldDeleted)
}
if m.success_get != nil {
fields = append(fields, fribbleheroset.FieldSuccessGet)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *FribbleHeroSetMutation) Field(name string) (ent.Value, bool) {
switch name {
case fribbleheroset.FieldHeroCode:
return m.HeroCode()
case fribbleheroset.FieldJSONContent:
return m.JSONContent()
case fribbleheroset.FieldHeroName:
return m.HeroName()
case fribbleheroset.FieldCreator:
return m.Creator()
case fribbleheroset.FieldCreateTime:
return m.CreateTime()
case fribbleheroset.FieldUpdater:
return m.Updater()
case fribbleheroset.FieldUpdateTime:
return m.UpdateTime()
case fribbleheroset.FieldDeleted:
return m.Deleted()
case fribbleheroset.FieldSuccessGet:
return m.SuccessGet()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *FribbleHeroSetMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case fribbleheroset.FieldHeroCode:
return m.OldHeroCode(ctx)
case fribbleheroset.FieldJSONContent:
return m.OldJSONContent(ctx)
case fribbleheroset.FieldHeroName:
return m.OldHeroName(ctx)
case fribbleheroset.FieldCreator:
return m.OldCreator(ctx)
case fribbleheroset.FieldCreateTime:
return m.OldCreateTime(ctx)
case fribbleheroset.FieldUpdater:
return m.OldUpdater(ctx)
case fribbleheroset.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case fribbleheroset.FieldDeleted:
return m.OldDeleted(ctx)
case fribbleheroset.FieldSuccessGet:
return m.OldSuccessGet(ctx)
}
return nil, fmt.Errorf("unknown FribbleHeroSet field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *FribbleHeroSetMutation) SetField(name string, value ent.Value) error {
switch name {
case fribbleheroset.FieldHeroCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroCode(v)
return nil
case fribbleheroset.FieldJSONContent:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetJSONContent(v)
return nil
case fribbleheroset.FieldHeroName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetHeroName(v)
return nil
case fribbleheroset.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case fribbleheroset.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case fribbleheroset.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case fribbleheroset.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case fribbleheroset.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
case fribbleheroset.FieldSuccessGet:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSuccessGet(v)
return nil
}
return fmt.Errorf("unknown FribbleHeroSet field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *FribbleHeroSetMutation) AddedFields() []string {
var fields []string
if m.addsuccess_get != nil {
fields = append(fields, fribbleheroset.FieldSuccessGet)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *FribbleHeroSetMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case fribbleheroset.FieldSuccessGet:
return m.AddedSuccessGet()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *FribbleHeroSetMutation) AddField(name string, value ent.Value) error {
switch name {
case fribbleheroset.FieldSuccessGet:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSuccessGet(v)
return nil
}
return fmt.Errorf("unknown FribbleHeroSet numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *FribbleHeroSetMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(fribbleheroset.FieldCreateTime) {
fields = append(fields, fribbleheroset.FieldCreateTime)
}
if m.FieldCleared(fribbleheroset.FieldUpdateTime) {
fields = append(fields, fribbleheroset.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *FribbleHeroSetMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *FribbleHeroSetMutation) ClearField(name string) error {
switch name {
case fribbleheroset.FieldCreateTime:
m.ClearCreateTime()
return nil
case fribbleheroset.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown FribbleHeroSet nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *FribbleHeroSetMutation) ResetField(name string) error {
switch name {
case fribbleheroset.FieldHeroCode:
m.ResetHeroCode()
return nil
case fribbleheroset.FieldJSONContent:
m.ResetJSONContent()
return nil
case fribbleheroset.FieldHeroName:
m.ResetHeroName()
return nil
case fribbleheroset.FieldCreator:
m.ResetCreator()
return nil
case fribbleheroset.FieldCreateTime:
m.ResetCreateTime()
return nil
case fribbleheroset.FieldUpdater:
m.ResetUpdater()
return nil
case fribbleheroset.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case fribbleheroset.FieldDeleted:
m.ResetDeleted()
return nil
case fribbleheroset.FieldSuccessGet:
m.ResetSuccessGet()
return nil
}
return fmt.Errorf("unknown FribbleHeroSet field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *FribbleHeroSetMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *FribbleHeroSetMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *FribbleHeroSetMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *FribbleHeroSetMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *FribbleHeroSetMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *FribbleHeroSetMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *FribbleHeroSetMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown FribbleHeroSet unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *FribbleHeroSetMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown FribbleHeroSet edge %s", name)
}
// GearSetInfoMutation represents an operation that mutates the GearSetInfo nodes in the graph.
type GearSetInfoMutation struct {
config
op Op
typ string
id *int64
level *int
addlevel *int
gear_id *int64
addgear_id *int64
enhance *int
addenhance *int
gear_type *string
gear_set_type *string
main_stat_type *string
main_stat_value *int
addmain_stat_value *int
sub_stat_one_type *string
sub_stat_one_value *int
addsub_stat_one_value *int
sub_stat_two_type *string
sub_stat_two_value *int
addsub_stat_two_value *int
sub_stat_three_type *string
sub_stat_three_value *int
addsub_stat_three_value *int
sub_stat_four_type *string
sub_stat_four_value *int
addsub_stat_four_value *int
account_code *string
creator *string
create_time *time.Time
updater *string
update_time *time.Time
deleted *bool
tenant_id *int64
addtenant_id *int64
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*GearSetInfo, error)
predicates []predicate.GearSetInfo
}
var _ ent.Mutation = (*GearSetInfoMutation)(nil)
// gearsetinfoOption allows management of the mutation configuration using functional options.
type gearsetinfoOption func(*GearSetInfoMutation)
// newGearSetInfoMutation creates new mutation for the GearSetInfo entity.
func newGearSetInfoMutation(c config, op Op, opts ...gearsetinfoOption) *GearSetInfoMutation {
m := &GearSetInfoMutation{
config: c,
op: op,
typ: TypeGearSetInfo,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withGearSetInfoID sets the ID field of the mutation.
func withGearSetInfoID(id int64) gearsetinfoOption {
return func(m *GearSetInfoMutation) {
var (
err error
once sync.Once
value *GearSetInfo
)
m.oldValue = func(ctx context.Context) (*GearSetInfo, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().GearSetInfo.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withGearSetInfo sets the old GearSetInfo of the mutation.
func withGearSetInfo(node *GearSetInfo) gearsetinfoOption {
return func(m *GearSetInfoMutation) {
m.oldValue = func(context.Context) (*GearSetInfo, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m GearSetInfoMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m GearSetInfoMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of GearSetInfo entities.
func (m *GearSetInfoMutation) SetID(id int64) {
m.id = &id
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *GearSetInfoMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *GearSetInfoMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().GearSetInfo.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetLevel sets the "level" field.
func (m *GearSetInfoMutation) SetLevel(i int) {
m.level = &i
m.addlevel = nil
}
// Level returns the value of the "level" field in the mutation.
func (m *GearSetInfoMutation) Level() (r int, exists bool) {
v := m.level
if v == nil {
return
}
return *v, true
}
// OldLevel returns the old "level" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldLevel(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldLevel is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldLevel requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldLevel: %w", err)
}
return oldValue.Level, nil
}
// AddLevel adds i to the "level" field.
func (m *GearSetInfoMutation) AddLevel(i int) {
if m.addlevel != nil {
*m.addlevel += i
} else {
m.addlevel = &i
}
}
// AddedLevel returns the value that was added to the "level" field in this mutation.
func (m *GearSetInfoMutation) AddedLevel() (r int, exists bool) {
v := m.addlevel
if v == nil {
return
}
return *v, true
}
// ResetLevel resets all changes to the "level" field.
func (m *GearSetInfoMutation) ResetLevel() {
m.level = nil
m.addlevel = nil
}
// SetGearID sets the "gear_id" field.
func (m *GearSetInfoMutation) SetGearID(i int64) {
m.gear_id = &i
m.addgear_id = nil
}
// GearID returns the value of the "gear_id" field in the mutation.
func (m *GearSetInfoMutation) GearID() (r int64, exists bool) {
v := m.gear_id
if v == nil {
return
}
return *v, true
}
// OldGearID returns the old "gear_id" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldGearID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldGearID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldGearID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldGearID: %w", err)
}
return oldValue.GearID, nil
}
// AddGearID adds i to the "gear_id" field.
func (m *GearSetInfoMutation) AddGearID(i int64) {
if m.addgear_id != nil {
*m.addgear_id += i
} else {
m.addgear_id = &i
}
}
// AddedGearID returns the value that was added to the "gear_id" field in this mutation.
func (m *GearSetInfoMutation) AddedGearID() (r int64, exists bool) {
v := m.addgear_id
if v == nil {
return
}
return *v, true
}
// ResetGearID resets all changes to the "gear_id" field.
func (m *GearSetInfoMutation) ResetGearID() {
m.gear_id = nil
m.addgear_id = nil
}
// SetEnhance sets the "enhance" field.
func (m *GearSetInfoMutation) SetEnhance(i int) {
m.enhance = &i
m.addenhance = nil
}
// Enhance returns the value of the "enhance" field in the mutation.
func (m *GearSetInfoMutation) Enhance() (r int, exists bool) {
v := m.enhance
if v == nil {
return
}
return *v, true
}
// OldEnhance returns the old "enhance" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldEnhance(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldEnhance is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldEnhance requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldEnhance: %w", err)
}
return oldValue.Enhance, nil
}
// AddEnhance adds i to the "enhance" field.
func (m *GearSetInfoMutation) AddEnhance(i int) {
if m.addenhance != nil {
*m.addenhance += i
} else {
m.addenhance = &i
}
}
// AddedEnhance returns the value that was added to the "enhance" field in this mutation.
func (m *GearSetInfoMutation) AddedEnhance() (r int, exists bool) {
v := m.addenhance
if v == nil {
return
}
return *v, true
}
// ResetEnhance resets all changes to the "enhance" field.
func (m *GearSetInfoMutation) ResetEnhance() {
m.enhance = nil
m.addenhance = nil
}
// SetGearType sets the "gear_type" field.
func (m *GearSetInfoMutation) SetGearType(s string) {
m.gear_type = &s
}
// GearType returns the value of the "gear_type" field in the mutation.
func (m *GearSetInfoMutation) GearType() (r string, exists bool) {
v := m.gear_type
if v == nil {
return
}
return *v, true
}
// OldGearType returns the old "gear_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldGearType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldGearType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldGearType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldGearType: %w", err)
}
return oldValue.GearType, nil
}
// ResetGearType resets all changes to the "gear_type" field.
func (m *GearSetInfoMutation) ResetGearType() {
m.gear_type = nil
}
// SetGearSetType sets the "gear_set_type" field.
func (m *GearSetInfoMutation) SetGearSetType(s string) {
m.gear_set_type = &s
}
// GearSetType returns the value of the "gear_set_type" field in the mutation.
func (m *GearSetInfoMutation) GearSetType() (r string, exists bool) {
v := m.gear_set_type
if v == nil {
return
}
return *v, true
}
// OldGearSetType returns the old "gear_set_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldGearSetType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldGearSetType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldGearSetType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldGearSetType: %w", err)
}
return oldValue.GearSetType, nil
}
// ResetGearSetType resets all changes to the "gear_set_type" field.
func (m *GearSetInfoMutation) ResetGearSetType() {
m.gear_set_type = nil
}
// SetMainStatType sets the "main_stat_type" field.
func (m *GearSetInfoMutation) SetMainStatType(s string) {
m.main_stat_type = &s
}
// MainStatType returns the value of the "main_stat_type" field in the mutation.
func (m *GearSetInfoMutation) MainStatType() (r string, exists bool) {
v := m.main_stat_type
if v == nil {
return
}
return *v, true
}
// OldMainStatType returns the old "main_stat_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldMainStatType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldMainStatType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldMainStatType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldMainStatType: %w", err)
}
return oldValue.MainStatType, nil
}
// ResetMainStatType resets all changes to the "main_stat_type" field.
func (m *GearSetInfoMutation) ResetMainStatType() {
m.main_stat_type = nil
}
// SetMainStatValue sets the "main_stat_value" field.
func (m *GearSetInfoMutation) SetMainStatValue(i int) {
m.main_stat_value = &i
m.addmain_stat_value = nil
}
// MainStatValue returns the value of the "main_stat_value" field in the mutation.
func (m *GearSetInfoMutation) MainStatValue() (r int, exists bool) {
v := m.main_stat_value
if v == nil {
return
}
return *v, true
}
// OldMainStatValue returns the old "main_stat_value" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldMainStatValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldMainStatValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldMainStatValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldMainStatValue: %w", err)
}
return oldValue.MainStatValue, nil
}
// AddMainStatValue adds i to the "main_stat_value" field.
func (m *GearSetInfoMutation) AddMainStatValue(i int) {
if m.addmain_stat_value != nil {
*m.addmain_stat_value += i
} else {
m.addmain_stat_value = &i
}
}
// AddedMainStatValue returns the value that was added to the "main_stat_value" field in this mutation.
func (m *GearSetInfoMutation) AddedMainStatValue() (r int, exists bool) {
v := m.addmain_stat_value
if v == nil {
return
}
return *v, true
}
// ResetMainStatValue resets all changes to the "main_stat_value" field.
func (m *GearSetInfoMutation) ResetMainStatValue() {
m.main_stat_value = nil
m.addmain_stat_value = nil
}
// SetSubStatOneType sets the "sub_stat_one_type" field.
func (m *GearSetInfoMutation) SetSubStatOneType(s string) {
m.sub_stat_one_type = &s
}
// SubStatOneType returns the value of the "sub_stat_one_type" field in the mutation.
func (m *GearSetInfoMutation) SubStatOneType() (r string, exists bool) {
v := m.sub_stat_one_type
if v == nil {
return
}
return *v, true
}
// OldSubStatOneType returns the old "sub_stat_one_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatOneType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatOneType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatOneType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatOneType: %w", err)
}
return oldValue.SubStatOneType, nil
}
// ResetSubStatOneType resets all changes to the "sub_stat_one_type" field.
func (m *GearSetInfoMutation) ResetSubStatOneType() {
m.sub_stat_one_type = nil
}
// SetSubStatOneValue sets the "sub_stat_one_value" field.
func (m *GearSetInfoMutation) SetSubStatOneValue(i int) {
m.sub_stat_one_value = &i
m.addsub_stat_one_value = nil
}
// SubStatOneValue returns the value of the "sub_stat_one_value" field in the mutation.
func (m *GearSetInfoMutation) SubStatOneValue() (r int, exists bool) {
v := m.sub_stat_one_value
if v == nil {
return
}
return *v, true
}
// OldSubStatOneValue returns the old "sub_stat_one_value" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatOneValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatOneValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatOneValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatOneValue: %w", err)
}
return oldValue.SubStatOneValue, nil
}
// AddSubStatOneValue adds i to the "sub_stat_one_value" field.
func (m *GearSetInfoMutation) AddSubStatOneValue(i int) {
if m.addsub_stat_one_value != nil {
*m.addsub_stat_one_value += i
} else {
m.addsub_stat_one_value = &i
}
}
// AddedSubStatOneValue returns the value that was added to the "sub_stat_one_value" field in this mutation.
func (m *GearSetInfoMutation) AddedSubStatOneValue() (r int, exists bool) {
v := m.addsub_stat_one_value
if v == nil {
return
}
return *v, true
}
// ResetSubStatOneValue resets all changes to the "sub_stat_one_value" field.
func (m *GearSetInfoMutation) ResetSubStatOneValue() {
m.sub_stat_one_value = nil
m.addsub_stat_one_value = nil
}
// SetSubStatTwoType sets the "sub_stat_two_type" field.
func (m *GearSetInfoMutation) SetSubStatTwoType(s string) {
m.sub_stat_two_type = &s
}
// SubStatTwoType returns the value of the "sub_stat_two_type" field in the mutation.
func (m *GearSetInfoMutation) SubStatTwoType() (r string, exists bool) {
v := m.sub_stat_two_type
if v == nil {
return
}
return *v, true
}
// OldSubStatTwoType returns the old "sub_stat_two_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatTwoType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatTwoType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatTwoType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatTwoType: %w", err)
}
return oldValue.SubStatTwoType, nil
}
// ResetSubStatTwoType resets all changes to the "sub_stat_two_type" field.
func (m *GearSetInfoMutation) ResetSubStatTwoType() {
m.sub_stat_two_type = nil
}
// SetSubStatTwoValue sets the "sub_stat_two_value" field.
func (m *GearSetInfoMutation) SetSubStatTwoValue(i int) {
m.sub_stat_two_value = &i
m.addsub_stat_two_value = nil
}
// SubStatTwoValue returns the value of the "sub_stat_two_value" field in the mutation.
func (m *GearSetInfoMutation) SubStatTwoValue() (r int, exists bool) {
v := m.sub_stat_two_value
if v == nil {
return
}
return *v, true
}
// OldSubStatTwoValue returns the old "sub_stat_two_value" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatTwoValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatTwoValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatTwoValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatTwoValue: %w", err)
}
return oldValue.SubStatTwoValue, nil
}
// AddSubStatTwoValue adds i to the "sub_stat_two_value" field.
func (m *GearSetInfoMutation) AddSubStatTwoValue(i int) {
if m.addsub_stat_two_value != nil {
*m.addsub_stat_two_value += i
} else {
m.addsub_stat_two_value = &i
}
}
// AddedSubStatTwoValue returns the value that was added to the "sub_stat_two_value" field in this mutation.
func (m *GearSetInfoMutation) AddedSubStatTwoValue() (r int, exists bool) {
v := m.addsub_stat_two_value
if v == nil {
return
}
return *v, true
}
// ResetSubStatTwoValue resets all changes to the "sub_stat_two_value" field.
func (m *GearSetInfoMutation) ResetSubStatTwoValue() {
m.sub_stat_two_value = nil
m.addsub_stat_two_value = nil
}
// SetSubStatThreeType sets the "sub_stat_three_type" field.
func (m *GearSetInfoMutation) SetSubStatThreeType(s string) {
m.sub_stat_three_type = &s
}
// SubStatThreeType returns the value of the "sub_stat_three_type" field in the mutation.
func (m *GearSetInfoMutation) SubStatThreeType() (r string, exists bool) {
v := m.sub_stat_three_type
if v == nil {
return
}
return *v, true
}
// OldSubStatThreeType returns the old "sub_stat_three_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatThreeType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatThreeType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatThreeType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatThreeType: %w", err)
}
return oldValue.SubStatThreeType, nil
}
// ResetSubStatThreeType resets all changes to the "sub_stat_three_type" field.
func (m *GearSetInfoMutation) ResetSubStatThreeType() {
m.sub_stat_three_type = nil
}
// SetSubStatThreeValue sets the "sub_stat_three_value" field.
func (m *GearSetInfoMutation) SetSubStatThreeValue(i int) {
m.sub_stat_three_value = &i
m.addsub_stat_three_value = nil
}
// SubStatThreeValue returns the value of the "sub_stat_three_value" field in the mutation.
func (m *GearSetInfoMutation) SubStatThreeValue() (r int, exists bool) {
v := m.sub_stat_three_value
if v == nil {
return
}
return *v, true
}
// OldSubStatThreeValue returns the old "sub_stat_three_value" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatThreeValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatThreeValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatThreeValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatThreeValue: %w", err)
}
return oldValue.SubStatThreeValue, nil
}
// AddSubStatThreeValue adds i to the "sub_stat_three_value" field.
func (m *GearSetInfoMutation) AddSubStatThreeValue(i int) {
if m.addsub_stat_three_value != nil {
*m.addsub_stat_three_value += i
} else {
m.addsub_stat_three_value = &i
}
}
// AddedSubStatThreeValue returns the value that was added to the "sub_stat_three_value" field in this mutation.
func (m *GearSetInfoMutation) AddedSubStatThreeValue() (r int, exists bool) {
v := m.addsub_stat_three_value
if v == nil {
return
}
return *v, true
}
// ResetSubStatThreeValue resets all changes to the "sub_stat_three_value" field.
func (m *GearSetInfoMutation) ResetSubStatThreeValue() {
m.sub_stat_three_value = nil
m.addsub_stat_three_value = nil
}
// SetSubStatFourType sets the "sub_stat_four_type" field.
func (m *GearSetInfoMutation) SetSubStatFourType(s string) {
m.sub_stat_four_type = &s
}
// SubStatFourType returns the value of the "sub_stat_four_type" field in the mutation.
func (m *GearSetInfoMutation) SubStatFourType() (r string, exists bool) {
v := m.sub_stat_four_type
if v == nil {
return
}
return *v, true
}
// OldSubStatFourType returns the old "sub_stat_four_type" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatFourType(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatFourType is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatFourType requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatFourType: %w", err)
}
return oldValue.SubStatFourType, nil
}
// ResetSubStatFourType resets all changes to the "sub_stat_four_type" field.
func (m *GearSetInfoMutation) ResetSubStatFourType() {
m.sub_stat_four_type = nil
}
// SetSubStatFourValue sets the "sub_stat_four_value" field.
func (m *GearSetInfoMutation) SetSubStatFourValue(i int) {
m.sub_stat_four_value = &i
m.addsub_stat_four_value = nil
}
// SubStatFourValue returns the value of the "sub_stat_four_value" field in the mutation.
func (m *GearSetInfoMutation) SubStatFourValue() (r int, exists bool) {
v := m.sub_stat_four_value
if v == nil {
return
}
return *v, true
}
// OldSubStatFourValue returns the old "sub_stat_four_value" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldSubStatFourValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSubStatFourValue is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSubStatFourValue requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSubStatFourValue: %w", err)
}
return oldValue.SubStatFourValue, nil
}
// AddSubStatFourValue adds i to the "sub_stat_four_value" field.
func (m *GearSetInfoMutation) AddSubStatFourValue(i int) {
if m.addsub_stat_four_value != nil {
*m.addsub_stat_four_value += i
} else {
m.addsub_stat_four_value = &i
}
}
// AddedSubStatFourValue returns the value that was added to the "sub_stat_four_value" field in this mutation.
func (m *GearSetInfoMutation) AddedSubStatFourValue() (r int, exists bool) {
v := m.addsub_stat_four_value
if v == nil {
return
}
return *v, true
}
// ResetSubStatFourValue resets all changes to the "sub_stat_four_value" field.
func (m *GearSetInfoMutation) ResetSubStatFourValue() {
m.sub_stat_four_value = nil
m.addsub_stat_four_value = nil
}
// SetAccountCode sets the "account_code" field.
func (m *GearSetInfoMutation) SetAccountCode(s string) {
m.account_code = &s
}
// AccountCode returns the value of the "account_code" field in the mutation.
func (m *GearSetInfoMutation) AccountCode() (r string, exists bool) {
v := m.account_code
if v == nil {
return
}
return *v, true
}
// OldAccountCode returns the old "account_code" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldAccountCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAccountCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAccountCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAccountCode: %w", err)
}
return oldValue.AccountCode, nil
}
// ResetAccountCode resets all changes to the "account_code" field.
func (m *GearSetInfoMutation) ResetAccountCode() {
m.account_code = nil
}
// SetCreator sets the "creator" field.
func (m *GearSetInfoMutation) SetCreator(s string) {
m.creator = &s
}
// Creator returns the value of the "creator" field in the mutation.
func (m *GearSetInfoMutation) Creator() (r string, exists bool) {
v := m.creator
if v == nil {
return
}
return *v, true
}
// OldCreator returns the old "creator" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldCreator(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreator is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreator requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreator: %w", err)
}
return oldValue.Creator, nil
}
// ResetCreator resets all changes to the "creator" field.
func (m *GearSetInfoMutation) ResetCreator() {
m.creator = nil
}
// SetCreateTime sets the "create_time" field.
func (m *GearSetInfoMutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *GearSetInfoMutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// OldCreateTime returns the old "create_time" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldCreateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
}
return oldValue.CreateTime, nil
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *GearSetInfoMutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[gearsetinfo.FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *GearSetInfoMutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[gearsetinfo.FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *GearSetInfoMutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, gearsetinfo.FieldCreateTime)
}
// SetUpdater sets the "updater" field.
func (m *GearSetInfoMutation) SetUpdater(s string) {
m.updater = &s
}
// Updater returns the value of the "updater" field in the mutation.
func (m *GearSetInfoMutation) Updater() (r string, exists bool) {
v := m.updater
if v == nil {
return
}
return *v, true
}
// OldUpdater returns the old "updater" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldUpdater(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdater is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdater requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdater: %w", err)
}
return oldValue.Updater, nil
}
// ResetUpdater resets all changes to the "updater" field.
func (m *GearSetInfoMutation) ResetUpdater() {
m.updater = nil
}
// SetUpdateTime sets the "update_time" field.
func (m *GearSetInfoMutation) SetUpdateTime(t time.Time) {
m.update_time = &t
}
// UpdateTime returns the value of the "update_time" field in the mutation.
func (m *GearSetInfoMutation) UpdateTime() (r time.Time, exists bool) {
v := m.update_time
if v == nil {
return
}
return *v, true
}
// OldUpdateTime returns the old "update_time" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldUpdateTime(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
}
return oldValue.UpdateTime, nil
}
// ClearUpdateTime clears the value of the "update_time" field.
func (m *GearSetInfoMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[gearsetinfo.FieldUpdateTime] = struct{}{}
}
// UpdateTimeCleared returns if the "update_time" field was cleared in this mutation.
func (m *GearSetInfoMutation) UpdateTimeCleared() bool {
_, ok := m.clearedFields[gearsetinfo.FieldUpdateTime]
return ok
}
// ResetUpdateTime resets all changes to the "update_time" field.
func (m *GearSetInfoMutation) ResetUpdateTime() {
m.update_time = nil
delete(m.clearedFields, gearsetinfo.FieldUpdateTime)
}
// SetDeleted sets the "deleted" field.
func (m *GearSetInfoMutation) SetDeleted(b bool) {
m.deleted = &b
}
// Deleted returns the value of the "deleted" field in the mutation.
func (m *GearSetInfoMutation) Deleted() (r bool, exists bool) {
v := m.deleted
if v == nil {
return
}
return *v, true
}
// OldDeleted returns the old "deleted" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldDeleted(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldDeleted is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldDeleted requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldDeleted: %w", err)
}
return oldValue.Deleted, nil
}
// ResetDeleted resets all changes to the "deleted" field.
func (m *GearSetInfoMutation) ResetDeleted() {
m.deleted = nil
}
// SetTenantID sets the "tenant_id" field.
func (m *GearSetInfoMutation) SetTenantID(i int64) {
m.tenant_id = &i
m.addtenant_id = nil
}
// TenantID returns the value of the "tenant_id" field in the mutation.
func (m *GearSetInfoMutation) TenantID() (r int64, exists bool) {
v := m.tenant_id
if v == nil {
return
}
return *v, true
}
// OldTenantID returns the old "tenant_id" field's value of the GearSetInfo entity.
// If the GearSetInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *GearSetInfoMutation) OldTenantID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldTenantID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldTenantID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldTenantID: %w", err)
}
return oldValue.TenantID, nil
}
// AddTenantID adds i to the "tenant_id" field.
func (m *GearSetInfoMutation) AddTenantID(i int64) {
if m.addtenant_id != nil {
*m.addtenant_id += i
} else {
m.addtenant_id = &i
}
}
// AddedTenantID returns the value that was added to the "tenant_id" field in this mutation.
func (m *GearSetInfoMutation) AddedTenantID() (r int64, exists bool) {
v := m.addtenant_id
if v == nil {
return
}
return *v, true
}
// ResetTenantID resets all changes to the "tenant_id" field.
func (m *GearSetInfoMutation) ResetTenantID() {
m.tenant_id = nil
m.addtenant_id = nil
}
// Where appends a list predicates to the GearSetInfoMutation builder.
func (m *GearSetInfoMutation) Where(ps ...predicate.GearSetInfo) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the GearSetInfoMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *GearSetInfoMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.GearSetInfo, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *GearSetInfoMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *GearSetInfoMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (GearSetInfo).
func (m *GearSetInfoMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *GearSetInfoMutation) Fields() []string {
fields := make([]string, 0, 22)
if m.level != nil {
fields = append(fields, gearsetinfo.FieldLevel)
}
if m.gear_id != nil {
fields = append(fields, gearsetinfo.FieldGearID)
}
if m.enhance != nil {
fields = append(fields, gearsetinfo.FieldEnhance)
}
if m.gear_type != nil {
fields = append(fields, gearsetinfo.FieldGearType)
}
if m.gear_set_type != nil {
fields = append(fields, gearsetinfo.FieldGearSetType)
}
if m.main_stat_type != nil {
fields = append(fields, gearsetinfo.FieldMainStatType)
}
if m.main_stat_value != nil {
fields = append(fields, gearsetinfo.FieldMainStatValue)
}
if m.sub_stat_one_type != nil {
fields = append(fields, gearsetinfo.FieldSubStatOneType)
}
if m.sub_stat_one_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatOneValue)
}
if m.sub_stat_two_type != nil {
fields = append(fields, gearsetinfo.FieldSubStatTwoType)
}
if m.sub_stat_two_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatTwoValue)
}
if m.sub_stat_three_type != nil {
fields = append(fields, gearsetinfo.FieldSubStatThreeType)
}
if m.sub_stat_three_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatThreeValue)
}
if m.sub_stat_four_type != nil {
fields = append(fields, gearsetinfo.FieldSubStatFourType)
}
if m.sub_stat_four_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatFourValue)
}
if m.account_code != nil {
fields = append(fields, gearsetinfo.FieldAccountCode)
}
if m.creator != nil {
fields = append(fields, gearsetinfo.FieldCreator)
}
if m.create_time != nil {
fields = append(fields, gearsetinfo.FieldCreateTime)
}
if m.updater != nil {
fields = append(fields, gearsetinfo.FieldUpdater)
}
if m.update_time != nil {
fields = append(fields, gearsetinfo.FieldUpdateTime)
}
if m.deleted != nil {
fields = append(fields, gearsetinfo.FieldDeleted)
}
if m.tenant_id != nil {
fields = append(fields, gearsetinfo.FieldTenantID)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *GearSetInfoMutation) Field(name string) (ent.Value, bool) {
switch name {
case gearsetinfo.FieldLevel:
return m.Level()
case gearsetinfo.FieldGearID:
return m.GearID()
case gearsetinfo.FieldEnhance:
return m.Enhance()
case gearsetinfo.FieldGearType:
return m.GearType()
case gearsetinfo.FieldGearSetType:
return m.GearSetType()
case gearsetinfo.FieldMainStatType:
return m.MainStatType()
case gearsetinfo.FieldMainStatValue:
return m.MainStatValue()
case gearsetinfo.FieldSubStatOneType:
return m.SubStatOneType()
case gearsetinfo.FieldSubStatOneValue:
return m.SubStatOneValue()
case gearsetinfo.FieldSubStatTwoType:
return m.SubStatTwoType()
case gearsetinfo.FieldSubStatTwoValue:
return m.SubStatTwoValue()
case gearsetinfo.FieldSubStatThreeType:
return m.SubStatThreeType()
case gearsetinfo.FieldSubStatThreeValue:
return m.SubStatThreeValue()
case gearsetinfo.FieldSubStatFourType:
return m.SubStatFourType()
case gearsetinfo.FieldSubStatFourValue:
return m.SubStatFourValue()
case gearsetinfo.FieldAccountCode:
return m.AccountCode()
case gearsetinfo.FieldCreator:
return m.Creator()
case gearsetinfo.FieldCreateTime:
return m.CreateTime()
case gearsetinfo.FieldUpdater:
return m.Updater()
case gearsetinfo.FieldUpdateTime:
return m.UpdateTime()
case gearsetinfo.FieldDeleted:
return m.Deleted()
case gearsetinfo.FieldTenantID:
return m.TenantID()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *GearSetInfoMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case gearsetinfo.FieldLevel:
return m.OldLevel(ctx)
case gearsetinfo.FieldGearID:
return m.OldGearID(ctx)
case gearsetinfo.FieldEnhance:
return m.OldEnhance(ctx)
case gearsetinfo.FieldGearType:
return m.OldGearType(ctx)
case gearsetinfo.FieldGearSetType:
return m.OldGearSetType(ctx)
case gearsetinfo.FieldMainStatType:
return m.OldMainStatType(ctx)
case gearsetinfo.FieldMainStatValue:
return m.OldMainStatValue(ctx)
case gearsetinfo.FieldSubStatOneType:
return m.OldSubStatOneType(ctx)
case gearsetinfo.FieldSubStatOneValue:
return m.OldSubStatOneValue(ctx)
case gearsetinfo.FieldSubStatTwoType:
return m.OldSubStatTwoType(ctx)
case gearsetinfo.FieldSubStatTwoValue:
return m.OldSubStatTwoValue(ctx)
case gearsetinfo.FieldSubStatThreeType:
return m.OldSubStatThreeType(ctx)
case gearsetinfo.FieldSubStatThreeValue:
return m.OldSubStatThreeValue(ctx)
case gearsetinfo.FieldSubStatFourType:
return m.OldSubStatFourType(ctx)
case gearsetinfo.FieldSubStatFourValue:
return m.OldSubStatFourValue(ctx)
case gearsetinfo.FieldAccountCode:
return m.OldAccountCode(ctx)
case gearsetinfo.FieldCreator:
return m.OldCreator(ctx)
case gearsetinfo.FieldCreateTime:
return m.OldCreateTime(ctx)
case gearsetinfo.FieldUpdater:
return m.OldUpdater(ctx)
case gearsetinfo.FieldUpdateTime:
return m.OldUpdateTime(ctx)
case gearsetinfo.FieldDeleted:
return m.OldDeleted(ctx)
case gearsetinfo.FieldTenantID:
return m.OldTenantID(ctx)
}
return nil, fmt.Errorf("unknown GearSetInfo field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *GearSetInfoMutation) SetField(name string, value ent.Value) error {
switch name {
case gearsetinfo.FieldLevel:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetLevel(v)
return nil
case gearsetinfo.FieldGearID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetGearID(v)
return nil
case gearsetinfo.FieldEnhance:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetEnhance(v)
return nil
case gearsetinfo.FieldGearType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetGearType(v)
return nil
case gearsetinfo.FieldGearSetType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetGearSetType(v)
return nil
case gearsetinfo.FieldMainStatType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetMainStatType(v)
return nil
case gearsetinfo.FieldMainStatValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetMainStatValue(v)
return nil
case gearsetinfo.FieldSubStatOneType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatOneType(v)
return nil
case gearsetinfo.FieldSubStatOneValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatOneValue(v)
return nil
case gearsetinfo.FieldSubStatTwoType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatTwoType(v)
return nil
case gearsetinfo.FieldSubStatTwoValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatTwoValue(v)
return nil
case gearsetinfo.FieldSubStatThreeType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatThreeType(v)
return nil
case gearsetinfo.FieldSubStatThreeValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatThreeValue(v)
return nil
case gearsetinfo.FieldSubStatFourType:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatFourType(v)
return nil
case gearsetinfo.FieldSubStatFourValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSubStatFourValue(v)
return nil
case gearsetinfo.FieldAccountCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAccountCode(v)
return nil
case gearsetinfo.FieldCreator:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreator(v)
return nil
case gearsetinfo.FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
case gearsetinfo.FieldUpdater:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdater(v)
return nil
case gearsetinfo.FieldUpdateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUpdateTime(v)
return nil
case gearsetinfo.FieldDeleted:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetDeleted(v)
return nil
case gearsetinfo.FieldTenantID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetTenantID(v)
return nil
}
return fmt.Errorf("unknown GearSetInfo field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *GearSetInfoMutation) AddedFields() []string {
var fields []string
if m.addlevel != nil {
fields = append(fields, gearsetinfo.FieldLevel)
}
if m.addgear_id != nil {
fields = append(fields, gearsetinfo.FieldGearID)
}
if m.addenhance != nil {
fields = append(fields, gearsetinfo.FieldEnhance)
}
if m.addmain_stat_value != nil {
fields = append(fields, gearsetinfo.FieldMainStatValue)
}
if m.addsub_stat_one_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatOneValue)
}
if m.addsub_stat_two_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatTwoValue)
}
if m.addsub_stat_three_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatThreeValue)
}
if m.addsub_stat_four_value != nil {
fields = append(fields, gearsetinfo.FieldSubStatFourValue)
}
if m.addtenant_id != nil {
fields = append(fields, gearsetinfo.FieldTenantID)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *GearSetInfoMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case gearsetinfo.FieldLevel:
return m.AddedLevel()
case gearsetinfo.FieldGearID:
return m.AddedGearID()
case gearsetinfo.FieldEnhance:
return m.AddedEnhance()
case gearsetinfo.FieldMainStatValue:
return m.AddedMainStatValue()
case gearsetinfo.FieldSubStatOneValue:
return m.AddedSubStatOneValue()
case gearsetinfo.FieldSubStatTwoValue:
return m.AddedSubStatTwoValue()
case gearsetinfo.FieldSubStatThreeValue:
return m.AddedSubStatThreeValue()
case gearsetinfo.FieldSubStatFourValue:
return m.AddedSubStatFourValue()
case gearsetinfo.FieldTenantID:
return m.AddedTenantID()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *GearSetInfoMutation) AddField(name string, value ent.Value) error {
switch name {
case gearsetinfo.FieldLevel:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddLevel(v)
return nil
case gearsetinfo.FieldGearID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddGearID(v)
return nil
case gearsetinfo.FieldEnhance:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddEnhance(v)
return nil
case gearsetinfo.FieldMainStatValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddMainStatValue(v)
return nil
case gearsetinfo.FieldSubStatOneValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSubStatOneValue(v)
return nil
case gearsetinfo.FieldSubStatTwoValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSubStatTwoValue(v)
return nil
case gearsetinfo.FieldSubStatThreeValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSubStatThreeValue(v)
return nil
case gearsetinfo.FieldSubStatFourValue:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSubStatFourValue(v)
return nil
case gearsetinfo.FieldTenantID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddTenantID(v)
return nil
}
return fmt.Errorf("unknown GearSetInfo numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *GearSetInfoMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(gearsetinfo.FieldCreateTime) {
fields = append(fields, gearsetinfo.FieldCreateTime)
}
if m.FieldCleared(gearsetinfo.FieldUpdateTime) {
fields = append(fields, gearsetinfo.FieldUpdateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *GearSetInfoMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *GearSetInfoMutation) ClearField(name string) error {
switch name {
case gearsetinfo.FieldCreateTime:
m.ClearCreateTime()
return nil
case gearsetinfo.FieldUpdateTime:
m.ClearUpdateTime()
return nil
}
return fmt.Errorf("unknown GearSetInfo nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *GearSetInfoMutation) ResetField(name string) error {
switch name {
case gearsetinfo.FieldLevel:
m.ResetLevel()
return nil
case gearsetinfo.FieldGearID:
m.ResetGearID()
return nil
case gearsetinfo.FieldEnhance:
m.ResetEnhance()
return nil
case gearsetinfo.FieldGearType:
m.ResetGearType()
return nil
case gearsetinfo.FieldGearSetType:
m.ResetGearSetType()
return nil
case gearsetinfo.FieldMainStatType:
m.ResetMainStatType()
return nil
case gearsetinfo.FieldMainStatValue:
m.ResetMainStatValue()
return nil
case gearsetinfo.FieldSubStatOneType:
m.ResetSubStatOneType()
return nil
case gearsetinfo.FieldSubStatOneValue:
m.ResetSubStatOneValue()
return nil
case gearsetinfo.FieldSubStatTwoType:
m.ResetSubStatTwoType()
return nil
case gearsetinfo.FieldSubStatTwoValue:
m.ResetSubStatTwoValue()
return nil
case gearsetinfo.FieldSubStatThreeType:
m.ResetSubStatThreeType()
return nil
case gearsetinfo.FieldSubStatThreeValue:
m.ResetSubStatThreeValue()
return nil
case gearsetinfo.FieldSubStatFourType:
m.ResetSubStatFourType()
return nil
case gearsetinfo.FieldSubStatFourValue:
m.ResetSubStatFourValue()
return nil
case gearsetinfo.FieldAccountCode:
m.ResetAccountCode()
return nil
case gearsetinfo.FieldCreator:
m.ResetCreator()
return nil
case gearsetinfo.FieldCreateTime:
m.ResetCreateTime()
return nil
case gearsetinfo.FieldUpdater:
m.ResetUpdater()
return nil
case gearsetinfo.FieldUpdateTime:
m.ResetUpdateTime()
return nil
case gearsetinfo.FieldDeleted:
m.ResetDeleted()
return nil
case gearsetinfo.FieldTenantID:
m.ResetTenantID()
return nil
}
return fmt.Errorf("unknown GearSetInfo field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *GearSetInfoMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *GearSetInfoMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *GearSetInfoMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *GearSetInfoMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *GearSetInfoMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *GearSetInfoMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *GearSetInfoMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown GearSetInfo unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *GearSetInfoMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown GearSetInfo edge %s", name)
}