1557 lines
40 KiB
Go
1557 lines
40 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"api/ent/predicate"
|
|
"api/ent/ue"
|
|
"api/ent/user"
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// UeUpdate is the builder for updating Ue entities.
|
|
type UeUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *UeMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the UeUpdate builder.
|
|
func (uu *UeUpdate) Where(ps ...predicate.Ue) *UeUpdate {
|
|
uu.mutation.Where(ps...)
|
|
return uu
|
|
}
|
|
|
|
// SetLimit sets the "limit" field.
|
|
func (uu *UeUpdate) SetLimit(b bool) *UeUpdate {
|
|
uu.mutation.SetLimit(b)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLimit sets the "limit" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLimit(b *bool) *UeUpdate {
|
|
if b != nil {
|
|
uu.SetLimit(*b)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearLimit clears the value of the "limit" field.
|
|
func (uu *UeUpdate) ClearLimit() *UeUpdate {
|
|
uu.mutation.ClearLimit()
|
|
return uu
|
|
}
|
|
|
|
// SetLimitBoss sets the "limit_boss" field.
|
|
func (uu *UeUpdate) SetLimitBoss(b bool) *UeUpdate {
|
|
uu.mutation.SetLimitBoss(b)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLimitBoss sets the "limit_boss" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLimitBoss(b *bool) *UeUpdate {
|
|
if b != nil {
|
|
uu.SetLimitBoss(*b)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearLimitBoss clears the value of the "limit_boss" field.
|
|
func (uu *UeUpdate) ClearLimitBoss() *UeUpdate {
|
|
uu.mutation.ClearLimitBoss()
|
|
return uu
|
|
}
|
|
|
|
// SetLimitItem sets the "limit_item" field.
|
|
func (uu *UeUpdate) SetLimitItem(b bool) *UeUpdate {
|
|
uu.mutation.SetLimitItem(b)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLimitItem sets the "limit_item" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLimitItem(b *bool) *UeUpdate {
|
|
if b != nil {
|
|
uu.SetLimitItem(*b)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearLimitItem clears the value of the "limit_item" field.
|
|
func (uu *UeUpdate) ClearLimitItem() *UeUpdate {
|
|
uu.mutation.ClearLimitItem()
|
|
return uu
|
|
}
|
|
|
|
// SetLv sets the "lv" field.
|
|
func (uu *UeUpdate) SetLv(i int) *UeUpdate {
|
|
uu.mutation.ResetLv()
|
|
uu.mutation.SetLv(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLv sets the "lv" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLv(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLv(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLv adds i to the "lv" field.
|
|
func (uu *UeUpdate) AddLv(i int) *UeUpdate {
|
|
uu.mutation.AddLv(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLv clears the value of the "lv" field.
|
|
func (uu *UeUpdate) ClearLv() *UeUpdate {
|
|
uu.mutation.ClearLv()
|
|
return uu
|
|
}
|
|
|
|
// SetLvPoint sets the "lv_point" field.
|
|
func (uu *UeUpdate) SetLvPoint(i int) *UeUpdate {
|
|
uu.mutation.ResetLvPoint()
|
|
uu.mutation.SetLvPoint(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLvPoint sets the "lv_point" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLvPoint(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLvPoint(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLvPoint adds i to the "lv_point" field.
|
|
func (uu *UeUpdate) AddLvPoint(i int) *UeUpdate {
|
|
uu.mutation.AddLvPoint(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLvPoint clears the value of the "lv_point" field.
|
|
func (uu *UeUpdate) ClearLvPoint() *UeUpdate {
|
|
uu.mutation.ClearLvPoint()
|
|
return uu
|
|
}
|
|
|
|
// SetModel sets the "model" field.
|
|
func (uu *UeUpdate) SetModel(i int) *UeUpdate {
|
|
uu.mutation.ResetModel()
|
|
uu.mutation.SetModel(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableModel sets the "model" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableModel(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetModel(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddModel adds i to the "model" field.
|
|
func (uu *UeUpdate) AddModel(i int) *UeUpdate {
|
|
uu.mutation.AddModel(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearModel clears the value of the "model" field.
|
|
func (uu *UeUpdate) ClearModel() *UeUpdate {
|
|
uu.mutation.ClearModel()
|
|
return uu
|
|
}
|
|
|
|
// SetSword sets the "sword" field.
|
|
func (uu *UeUpdate) SetSword(i int) *UeUpdate {
|
|
uu.mutation.ResetSword()
|
|
uu.mutation.SetSword(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableSword sets the "sword" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableSword(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetSword(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddSword adds i to the "sword" field.
|
|
func (uu *UeUpdate) AddSword(i int) *UeUpdate {
|
|
uu.mutation.AddSword(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearSword clears the value of the "sword" field.
|
|
func (uu *UeUpdate) ClearSword() *UeUpdate {
|
|
uu.mutation.ClearSword()
|
|
return uu
|
|
}
|
|
|
|
// SetCard sets the "card" field.
|
|
func (uu *UeUpdate) SetCard(i int) *UeUpdate {
|
|
uu.mutation.ResetCard()
|
|
uu.mutation.SetCard(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableCard sets the "card" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableCard(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetCard(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddCard adds i to the "card" field.
|
|
func (uu *UeUpdate) AddCard(i int) *UeUpdate {
|
|
uu.mutation.AddCard(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearCard clears the value of the "card" field.
|
|
func (uu *UeUpdate) ClearCard() *UeUpdate {
|
|
uu.mutation.ClearCard()
|
|
return uu
|
|
}
|
|
|
|
// SetMode sets the "mode" field.
|
|
func (uu *UeUpdate) SetMode(s string) *UeUpdate {
|
|
uu.mutation.SetMode(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableMode sets the "mode" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableMode(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetMode(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearMode clears the value of the "mode" field.
|
|
func (uu *UeUpdate) ClearMode() *UeUpdate {
|
|
uu.mutation.ClearMode()
|
|
return uu
|
|
}
|
|
|
|
// SetToken sets the "token" field.
|
|
func (uu *UeUpdate) SetToken(s string) *UeUpdate {
|
|
uu.mutation.SetToken(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableToken(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetToken(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearToken clears the value of the "token" field.
|
|
func (uu *UeUpdate) ClearToken() *UeUpdate {
|
|
uu.mutation.ClearToken()
|
|
return uu
|
|
}
|
|
|
|
// SetCp sets the "cp" field.
|
|
func (uu *UeUpdate) SetCp(i int) *UeUpdate {
|
|
uu.mutation.ResetCp()
|
|
uu.mutation.SetCp(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableCp sets the "cp" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableCp(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetCp(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddCp adds i to the "cp" field.
|
|
func (uu *UeUpdate) AddCp(i int) *UeUpdate {
|
|
uu.mutation.AddCp(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearCp clears the value of the "cp" field.
|
|
func (uu *UeUpdate) ClearCp() *UeUpdate {
|
|
uu.mutation.ClearCp()
|
|
return uu
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (uu *UeUpdate) SetCount(i int) *UeUpdate {
|
|
uu.mutation.ResetCount()
|
|
uu.mutation.SetCount(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableCount sets the "count" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableCount(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetCount(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddCount adds i to the "count" field.
|
|
func (uu *UeUpdate) AddCount(i int) *UeUpdate {
|
|
uu.mutation.AddCount(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearCount clears the value of the "count" field.
|
|
func (uu *UeUpdate) ClearCount() *UeUpdate {
|
|
uu.mutation.ClearCount()
|
|
return uu
|
|
}
|
|
|
|
// SetLocationX sets the "location_x" field.
|
|
func (uu *UeUpdate) SetLocationX(i int) *UeUpdate {
|
|
uu.mutation.ResetLocationX()
|
|
uu.mutation.SetLocationX(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLocationX sets the "location_x" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLocationX(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLocationX(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLocationX adds i to the "location_x" field.
|
|
func (uu *UeUpdate) AddLocationX(i int) *UeUpdate {
|
|
uu.mutation.AddLocationX(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLocationX clears the value of the "location_x" field.
|
|
func (uu *UeUpdate) ClearLocationX() *UeUpdate {
|
|
uu.mutation.ClearLocationX()
|
|
return uu
|
|
}
|
|
|
|
// SetLocationY sets the "location_y" field.
|
|
func (uu *UeUpdate) SetLocationY(i int) *UeUpdate {
|
|
uu.mutation.ResetLocationY()
|
|
uu.mutation.SetLocationY(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLocationY sets the "location_y" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLocationY(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLocationY(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLocationY adds i to the "location_y" field.
|
|
func (uu *UeUpdate) AddLocationY(i int) *UeUpdate {
|
|
uu.mutation.AddLocationY(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLocationY clears the value of the "location_y" field.
|
|
func (uu *UeUpdate) ClearLocationY() *UeUpdate {
|
|
uu.mutation.ClearLocationY()
|
|
return uu
|
|
}
|
|
|
|
// SetLocationZ sets the "location_z" field.
|
|
func (uu *UeUpdate) SetLocationZ(i int) *UeUpdate {
|
|
uu.mutation.ResetLocationZ()
|
|
uu.mutation.SetLocationZ(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLocationZ sets the "location_z" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLocationZ(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLocationZ(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLocationZ adds i to the "location_z" field.
|
|
func (uu *UeUpdate) AddLocationZ(i int) *UeUpdate {
|
|
uu.mutation.AddLocationZ(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLocationZ clears the value of the "location_z" field.
|
|
func (uu *UeUpdate) ClearLocationZ() *UeUpdate {
|
|
uu.mutation.ClearLocationZ()
|
|
return uu
|
|
}
|
|
|
|
// SetLocationN sets the "location_n" field.
|
|
func (uu *UeUpdate) SetLocationN(i int) *UeUpdate {
|
|
uu.mutation.ResetLocationN()
|
|
uu.mutation.SetLocationN(i)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableLocationN sets the "location_n" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableLocationN(i *int) *UeUpdate {
|
|
if i != nil {
|
|
uu.SetLocationN(*i)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// AddLocationN adds i to the "location_n" field.
|
|
func (uu *UeUpdate) AddLocationN(i int) *UeUpdate {
|
|
uu.mutation.AddLocationN(i)
|
|
return uu
|
|
}
|
|
|
|
// ClearLocationN clears the value of the "location_n" field.
|
|
func (uu *UeUpdate) ClearLocationN() *UeUpdate {
|
|
uu.mutation.ClearLocationN()
|
|
return uu
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (uu *UeUpdate) SetAuthor(s string) *UeUpdate {
|
|
uu.mutation.SetAuthor(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableAuthor sets the "author" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableAuthor(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetAuthor(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (uu *UeUpdate) ClearAuthor() *UeUpdate {
|
|
uu.mutation.ClearAuthor()
|
|
return uu
|
|
}
|
|
|
|
// SetGameLv sets the "game_lv" field.
|
|
func (uu *UeUpdate) SetGameLv(s string) *UeUpdate {
|
|
uu.mutation.SetGameLv(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableGameLv sets the "game_lv" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableGameLv(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetGameLv(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearGameLv clears the value of the "game_lv" field.
|
|
func (uu *UeUpdate) ClearGameLv() *UeUpdate {
|
|
uu.mutation.ClearGameLv()
|
|
return uu
|
|
}
|
|
|
|
// SetGameExp sets the "game_exp" field.
|
|
func (uu *UeUpdate) SetGameExp(s string) *UeUpdate {
|
|
uu.mutation.SetGameExp(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableGameExp sets the "game_exp" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableGameExp(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetGameExp(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearGameExp clears the value of the "game_exp" field.
|
|
func (uu *UeUpdate) ClearGameExp() *UeUpdate {
|
|
uu.mutation.ClearGameExp()
|
|
return uu
|
|
}
|
|
|
|
// SetGameID sets the "game_id" field.
|
|
func (uu *UeUpdate) SetGameID(s string) *UeUpdate {
|
|
uu.mutation.SetGameID(s)
|
|
return uu
|
|
}
|
|
|
|
// SetNillableGameID sets the "game_id" field if the given value is not nil.
|
|
func (uu *UeUpdate) SetNillableGameID(s *string) *UeUpdate {
|
|
if s != nil {
|
|
uu.SetGameID(*s)
|
|
}
|
|
return uu
|
|
}
|
|
|
|
// ClearGameID clears the value of the "game_id" field.
|
|
func (uu *UeUpdate) ClearGameID() *UeUpdate {
|
|
uu.mutation.ClearGameID()
|
|
return uu
|
|
}
|
|
|
|
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
|
func (uu *UeUpdate) SetOwnerID(id int) *UeUpdate {
|
|
uu.mutation.SetOwnerID(id)
|
|
return uu
|
|
}
|
|
|
|
// SetOwner sets the "owner" edge to the User entity.
|
|
func (uu *UeUpdate) SetOwner(u *User) *UeUpdate {
|
|
return uu.SetOwnerID(u.ID)
|
|
}
|
|
|
|
// Mutation returns the UeMutation object of the builder.
|
|
func (uu *UeUpdate) Mutation() *UeMutation {
|
|
return uu.mutation
|
|
}
|
|
|
|
// ClearOwner clears the "owner" edge to the User entity.
|
|
func (uu *UeUpdate) ClearOwner() *UeUpdate {
|
|
uu.mutation.ClearOwner()
|
|
return uu
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (uu *UeUpdate) Save(ctx context.Context) (int, error) {
|
|
return withHooks[int, UeMutation](ctx, uu.sqlSave, uu.mutation, uu.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (uu *UeUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := uu.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (uu *UeUpdate) Exec(ctx context.Context) error {
|
|
_, err := uu.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (uu *UeUpdate) ExecX(ctx context.Context) {
|
|
if err := uu.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (uu *UeUpdate) check() error {
|
|
if _, ok := uu.mutation.OwnerID(); uu.mutation.OwnerCleared() && !ok {
|
|
return errors.New(`ent: clearing a required unique edge "Ue.owner"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (uu *UeUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
if err := uu.check(); err != nil {
|
|
return n, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(ue.Table, ue.Columns, sqlgraph.NewFieldSpec(ue.FieldID, field.TypeInt))
|
|
if ps := uu.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := uu.mutation.Limit(); ok {
|
|
_spec.SetField(ue.FieldLimit, field.TypeBool, value)
|
|
}
|
|
if uu.mutation.LimitCleared() {
|
|
_spec.ClearField(ue.FieldLimit, field.TypeBool)
|
|
}
|
|
if value, ok := uu.mutation.LimitBoss(); ok {
|
|
_spec.SetField(ue.FieldLimitBoss, field.TypeBool, value)
|
|
}
|
|
if uu.mutation.LimitBossCleared() {
|
|
_spec.ClearField(ue.FieldLimitBoss, field.TypeBool)
|
|
}
|
|
if value, ok := uu.mutation.LimitItem(); ok {
|
|
_spec.SetField(ue.FieldLimitItem, field.TypeBool, value)
|
|
}
|
|
if uu.mutation.LimitItemCleared() {
|
|
_spec.ClearField(ue.FieldLimitItem, field.TypeBool)
|
|
}
|
|
if value, ok := uu.mutation.Lv(); ok {
|
|
_spec.SetField(ue.FieldLv, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLv(); ok {
|
|
_spec.AddField(ue.FieldLv, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LvCleared() {
|
|
_spec.ClearField(ue.FieldLv, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.LvPoint(); ok {
|
|
_spec.SetField(ue.FieldLvPoint, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLvPoint(); ok {
|
|
_spec.AddField(ue.FieldLvPoint, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LvPointCleared() {
|
|
_spec.ClearField(ue.FieldLvPoint, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Model(); ok {
|
|
_spec.SetField(ue.FieldModel, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedModel(); ok {
|
|
_spec.AddField(ue.FieldModel, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.ModelCleared() {
|
|
_spec.ClearField(ue.FieldModel, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Sword(); ok {
|
|
_spec.SetField(ue.FieldSword, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedSword(); ok {
|
|
_spec.AddField(ue.FieldSword, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.SwordCleared() {
|
|
_spec.ClearField(ue.FieldSword, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Card(); ok {
|
|
_spec.SetField(ue.FieldCard, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedCard(); ok {
|
|
_spec.AddField(ue.FieldCard, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.CardCleared() {
|
|
_spec.ClearField(ue.FieldCard, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Mode(); ok {
|
|
_spec.SetField(ue.FieldMode, field.TypeString, value)
|
|
}
|
|
if uu.mutation.ModeCleared() {
|
|
_spec.ClearField(ue.FieldMode, field.TypeString)
|
|
}
|
|
if value, ok := uu.mutation.Token(); ok {
|
|
_spec.SetField(ue.FieldToken, field.TypeString, value)
|
|
}
|
|
if uu.mutation.TokenCleared() {
|
|
_spec.ClearField(ue.FieldToken, field.TypeString)
|
|
}
|
|
if value, ok := uu.mutation.Cp(); ok {
|
|
_spec.SetField(ue.FieldCp, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedCp(); ok {
|
|
_spec.AddField(ue.FieldCp, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.CpCleared() {
|
|
_spec.ClearField(ue.FieldCp, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Count(); ok {
|
|
_spec.SetField(ue.FieldCount, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedCount(); ok {
|
|
_spec.AddField(ue.FieldCount, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.CountCleared() {
|
|
_spec.ClearField(ue.FieldCount, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.LocationX(); ok {
|
|
_spec.SetField(ue.FieldLocationX, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLocationX(); ok {
|
|
_spec.AddField(ue.FieldLocationX, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LocationXCleared() {
|
|
_spec.ClearField(ue.FieldLocationX, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.LocationY(); ok {
|
|
_spec.SetField(ue.FieldLocationY, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLocationY(); ok {
|
|
_spec.AddField(ue.FieldLocationY, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LocationYCleared() {
|
|
_spec.ClearField(ue.FieldLocationY, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.LocationZ(); ok {
|
|
_spec.SetField(ue.FieldLocationZ, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLocationZ(); ok {
|
|
_spec.AddField(ue.FieldLocationZ, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LocationZCleared() {
|
|
_spec.ClearField(ue.FieldLocationZ, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.LocationN(); ok {
|
|
_spec.SetField(ue.FieldLocationN, field.TypeInt, value)
|
|
}
|
|
if value, ok := uu.mutation.AddedLocationN(); ok {
|
|
_spec.AddField(ue.FieldLocationN, field.TypeInt, value)
|
|
}
|
|
if uu.mutation.LocationNCleared() {
|
|
_spec.ClearField(ue.FieldLocationN, field.TypeInt)
|
|
}
|
|
if value, ok := uu.mutation.Author(); ok {
|
|
_spec.SetField(ue.FieldAuthor, field.TypeString, value)
|
|
}
|
|
if uu.mutation.AuthorCleared() {
|
|
_spec.ClearField(ue.FieldAuthor, field.TypeString)
|
|
}
|
|
if value, ok := uu.mutation.GameLv(); ok {
|
|
_spec.SetField(ue.FieldGameLv, field.TypeString, value)
|
|
}
|
|
if uu.mutation.GameLvCleared() {
|
|
_spec.ClearField(ue.FieldGameLv, field.TypeString)
|
|
}
|
|
if value, ok := uu.mutation.GameExp(); ok {
|
|
_spec.SetField(ue.FieldGameExp, field.TypeString, value)
|
|
}
|
|
if uu.mutation.GameExpCleared() {
|
|
_spec.ClearField(ue.FieldGameExp, field.TypeString)
|
|
}
|
|
if value, ok := uu.mutation.GameID(); ok {
|
|
_spec.SetField(ue.FieldGameID, field.TypeString, value)
|
|
}
|
|
if uu.mutation.GameIDCleared() {
|
|
_spec.ClearField(ue.FieldGameID, field.TypeString)
|
|
}
|
|
if uu.mutation.CreatedAtCleared() {
|
|
_spec.ClearField(ue.FieldCreatedAt, field.TypeTime)
|
|
}
|
|
if uu.mutation.OwnerCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: ue.OwnerTable,
|
|
Columns: []string{ue.OwnerColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := uu.mutation.OwnerIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: ue.OwnerTable,
|
|
Columns: []string{ue.OwnerColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if n, err = sqlgraph.UpdateNodes(ctx, uu.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{ue.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
uu.mutation.done = true
|
|
return n, nil
|
|
}
|
|
|
|
// UeUpdateOne is the builder for updating a single Ue entity.
|
|
type UeUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *UeMutation
|
|
}
|
|
|
|
// SetLimit sets the "limit" field.
|
|
func (uuo *UeUpdateOne) SetLimit(b bool) *UeUpdateOne {
|
|
uuo.mutation.SetLimit(b)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLimit sets the "limit" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLimit(b *bool) *UeUpdateOne {
|
|
if b != nil {
|
|
uuo.SetLimit(*b)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearLimit clears the value of the "limit" field.
|
|
func (uuo *UeUpdateOne) ClearLimit() *UeUpdateOne {
|
|
uuo.mutation.ClearLimit()
|
|
return uuo
|
|
}
|
|
|
|
// SetLimitBoss sets the "limit_boss" field.
|
|
func (uuo *UeUpdateOne) SetLimitBoss(b bool) *UeUpdateOne {
|
|
uuo.mutation.SetLimitBoss(b)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLimitBoss sets the "limit_boss" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLimitBoss(b *bool) *UeUpdateOne {
|
|
if b != nil {
|
|
uuo.SetLimitBoss(*b)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearLimitBoss clears the value of the "limit_boss" field.
|
|
func (uuo *UeUpdateOne) ClearLimitBoss() *UeUpdateOne {
|
|
uuo.mutation.ClearLimitBoss()
|
|
return uuo
|
|
}
|
|
|
|
// SetLimitItem sets the "limit_item" field.
|
|
func (uuo *UeUpdateOne) SetLimitItem(b bool) *UeUpdateOne {
|
|
uuo.mutation.SetLimitItem(b)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLimitItem sets the "limit_item" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLimitItem(b *bool) *UeUpdateOne {
|
|
if b != nil {
|
|
uuo.SetLimitItem(*b)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearLimitItem clears the value of the "limit_item" field.
|
|
func (uuo *UeUpdateOne) ClearLimitItem() *UeUpdateOne {
|
|
uuo.mutation.ClearLimitItem()
|
|
return uuo
|
|
}
|
|
|
|
// SetLv sets the "lv" field.
|
|
func (uuo *UeUpdateOne) SetLv(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLv()
|
|
uuo.mutation.SetLv(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLv sets the "lv" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLv(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLv(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLv adds i to the "lv" field.
|
|
func (uuo *UeUpdateOne) AddLv(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLv(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLv clears the value of the "lv" field.
|
|
func (uuo *UeUpdateOne) ClearLv() *UeUpdateOne {
|
|
uuo.mutation.ClearLv()
|
|
return uuo
|
|
}
|
|
|
|
// SetLvPoint sets the "lv_point" field.
|
|
func (uuo *UeUpdateOne) SetLvPoint(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLvPoint()
|
|
uuo.mutation.SetLvPoint(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLvPoint sets the "lv_point" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLvPoint(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLvPoint(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLvPoint adds i to the "lv_point" field.
|
|
func (uuo *UeUpdateOne) AddLvPoint(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLvPoint(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLvPoint clears the value of the "lv_point" field.
|
|
func (uuo *UeUpdateOne) ClearLvPoint() *UeUpdateOne {
|
|
uuo.mutation.ClearLvPoint()
|
|
return uuo
|
|
}
|
|
|
|
// SetModel sets the "model" field.
|
|
func (uuo *UeUpdateOne) SetModel(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetModel()
|
|
uuo.mutation.SetModel(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableModel sets the "model" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableModel(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetModel(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddModel adds i to the "model" field.
|
|
func (uuo *UeUpdateOne) AddModel(i int) *UeUpdateOne {
|
|
uuo.mutation.AddModel(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearModel clears the value of the "model" field.
|
|
func (uuo *UeUpdateOne) ClearModel() *UeUpdateOne {
|
|
uuo.mutation.ClearModel()
|
|
return uuo
|
|
}
|
|
|
|
// SetSword sets the "sword" field.
|
|
func (uuo *UeUpdateOne) SetSword(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetSword()
|
|
uuo.mutation.SetSword(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableSword sets the "sword" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableSword(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetSword(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddSword adds i to the "sword" field.
|
|
func (uuo *UeUpdateOne) AddSword(i int) *UeUpdateOne {
|
|
uuo.mutation.AddSword(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearSword clears the value of the "sword" field.
|
|
func (uuo *UeUpdateOne) ClearSword() *UeUpdateOne {
|
|
uuo.mutation.ClearSword()
|
|
return uuo
|
|
}
|
|
|
|
// SetCard sets the "card" field.
|
|
func (uuo *UeUpdateOne) SetCard(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetCard()
|
|
uuo.mutation.SetCard(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableCard sets the "card" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableCard(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetCard(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddCard adds i to the "card" field.
|
|
func (uuo *UeUpdateOne) AddCard(i int) *UeUpdateOne {
|
|
uuo.mutation.AddCard(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearCard clears the value of the "card" field.
|
|
func (uuo *UeUpdateOne) ClearCard() *UeUpdateOne {
|
|
uuo.mutation.ClearCard()
|
|
return uuo
|
|
}
|
|
|
|
// SetMode sets the "mode" field.
|
|
func (uuo *UeUpdateOne) SetMode(s string) *UeUpdateOne {
|
|
uuo.mutation.SetMode(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableMode sets the "mode" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableMode(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetMode(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearMode clears the value of the "mode" field.
|
|
func (uuo *UeUpdateOne) ClearMode() *UeUpdateOne {
|
|
uuo.mutation.ClearMode()
|
|
return uuo
|
|
}
|
|
|
|
// SetToken sets the "token" field.
|
|
func (uuo *UeUpdateOne) SetToken(s string) *UeUpdateOne {
|
|
uuo.mutation.SetToken(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableToken(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetToken(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearToken clears the value of the "token" field.
|
|
func (uuo *UeUpdateOne) ClearToken() *UeUpdateOne {
|
|
uuo.mutation.ClearToken()
|
|
return uuo
|
|
}
|
|
|
|
// SetCp sets the "cp" field.
|
|
func (uuo *UeUpdateOne) SetCp(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetCp()
|
|
uuo.mutation.SetCp(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableCp sets the "cp" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableCp(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetCp(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddCp adds i to the "cp" field.
|
|
func (uuo *UeUpdateOne) AddCp(i int) *UeUpdateOne {
|
|
uuo.mutation.AddCp(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearCp clears the value of the "cp" field.
|
|
func (uuo *UeUpdateOne) ClearCp() *UeUpdateOne {
|
|
uuo.mutation.ClearCp()
|
|
return uuo
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (uuo *UeUpdateOne) SetCount(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetCount()
|
|
uuo.mutation.SetCount(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableCount sets the "count" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableCount(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetCount(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddCount adds i to the "count" field.
|
|
func (uuo *UeUpdateOne) AddCount(i int) *UeUpdateOne {
|
|
uuo.mutation.AddCount(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearCount clears the value of the "count" field.
|
|
func (uuo *UeUpdateOne) ClearCount() *UeUpdateOne {
|
|
uuo.mutation.ClearCount()
|
|
return uuo
|
|
}
|
|
|
|
// SetLocationX sets the "location_x" field.
|
|
func (uuo *UeUpdateOne) SetLocationX(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLocationX()
|
|
uuo.mutation.SetLocationX(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLocationX sets the "location_x" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLocationX(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLocationX(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLocationX adds i to the "location_x" field.
|
|
func (uuo *UeUpdateOne) AddLocationX(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLocationX(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLocationX clears the value of the "location_x" field.
|
|
func (uuo *UeUpdateOne) ClearLocationX() *UeUpdateOne {
|
|
uuo.mutation.ClearLocationX()
|
|
return uuo
|
|
}
|
|
|
|
// SetLocationY sets the "location_y" field.
|
|
func (uuo *UeUpdateOne) SetLocationY(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLocationY()
|
|
uuo.mutation.SetLocationY(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLocationY sets the "location_y" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLocationY(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLocationY(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLocationY adds i to the "location_y" field.
|
|
func (uuo *UeUpdateOne) AddLocationY(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLocationY(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLocationY clears the value of the "location_y" field.
|
|
func (uuo *UeUpdateOne) ClearLocationY() *UeUpdateOne {
|
|
uuo.mutation.ClearLocationY()
|
|
return uuo
|
|
}
|
|
|
|
// SetLocationZ sets the "location_z" field.
|
|
func (uuo *UeUpdateOne) SetLocationZ(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLocationZ()
|
|
uuo.mutation.SetLocationZ(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLocationZ sets the "location_z" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLocationZ(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLocationZ(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLocationZ adds i to the "location_z" field.
|
|
func (uuo *UeUpdateOne) AddLocationZ(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLocationZ(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLocationZ clears the value of the "location_z" field.
|
|
func (uuo *UeUpdateOne) ClearLocationZ() *UeUpdateOne {
|
|
uuo.mutation.ClearLocationZ()
|
|
return uuo
|
|
}
|
|
|
|
// SetLocationN sets the "location_n" field.
|
|
func (uuo *UeUpdateOne) SetLocationN(i int) *UeUpdateOne {
|
|
uuo.mutation.ResetLocationN()
|
|
uuo.mutation.SetLocationN(i)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableLocationN sets the "location_n" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableLocationN(i *int) *UeUpdateOne {
|
|
if i != nil {
|
|
uuo.SetLocationN(*i)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// AddLocationN adds i to the "location_n" field.
|
|
func (uuo *UeUpdateOne) AddLocationN(i int) *UeUpdateOne {
|
|
uuo.mutation.AddLocationN(i)
|
|
return uuo
|
|
}
|
|
|
|
// ClearLocationN clears the value of the "location_n" field.
|
|
func (uuo *UeUpdateOne) ClearLocationN() *UeUpdateOne {
|
|
uuo.mutation.ClearLocationN()
|
|
return uuo
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (uuo *UeUpdateOne) SetAuthor(s string) *UeUpdateOne {
|
|
uuo.mutation.SetAuthor(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableAuthor sets the "author" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableAuthor(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetAuthor(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (uuo *UeUpdateOne) ClearAuthor() *UeUpdateOne {
|
|
uuo.mutation.ClearAuthor()
|
|
return uuo
|
|
}
|
|
|
|
// SetGameLv sets the "game_lv" field.
|
|
func (uuo *UeUpdateOne) SetGameLv(s string) *UeUpdateOne {
|
|
uuo.mutation.SetGameLv(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableGameLv sets the "game_lv" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableGameLv(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetGameLv(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearGameLv clears the value of the "game_lv" field.
|
|
func (uuo *UeUpdateOne) ClearGameLv() *UeUpdateOne {
|
|
uuo.mutation.ClearGameLv()
|
|
return uuo
|
|
}
|
|
|
|
// SetGameExp sets the "game_exp" field.
|
|
func (uuo *UeUpdateOne) SetGameExp(s string) *UeUpdateOne {
|
|
uuo.mutation.SetGameExp(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableGameExp sets the "game_exp" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableGameExp(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetGameExp(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearGameExp clears the value of the "game_exp" field.
|
|
func (uuo *UeUpdateOne) ClearGameExp() *UeUpdateOne {
|
|
uuo.mutation.ClearGameExp()
|
|
return uuo
|
|
}
|
|
|
|
// SetGameID sets the "game_id" field.
|
|
func (uuo *UeUpdateOne) SetGameID(s string) *UeUpdateOne {
|
|
uuo.mutation.SetGameID(s)
|
|
return uuo
|
|
}
|
|
|
|
// SetNillableGameID sets the "game_id" field if the given value is not nil.
|
|
func (uuo *UeUpdateOne) SetNillableGameID(s *string) *UeUpdateOne {
|
|
if s != nil {
|
|
uuo.SetGameID(*s)
|
|
}
|
|
return uuo
|
|
}
|
|
|
|
// ClearGameID clears the value of the "game_id" field.
|
|
func (uuo *UeUpdateOne) ClearGameID() *UeUpdateOne {
|
|
uuo.mutation.ClearGameID()
|
|
return uuo
|
|
}
|
|
|
|
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
|
func (uuo *UeUpdateOne) SetOwnerID(id int) *UeUpdateOne {
|
|
uuo.mutation.SetOwnerID(id)
|
|
return uuo
|
|
}
|
|
|
|
// SetOwner sets the "owner" edge to the User entity.
|
|
func (uuo *UeUpdateOne) SetOwner(u *User) *UeUpdateOne {
|
|
return uuo.SetOwnerID(u.ID)
|
|
}
|
|
|
|
// Mutation returns the UeMutation object of the builder.
|
|
func (uuo *UeUpdateOne) Mutation() *UeMutation {
|
|
return uuo.mutation
|
|
}
|
|
|
|
// ClearOwner clears the "owner" edge to the User entity.
|
|
func (uuo *UeUpdateOne) ClearOwner() *UeUpdateOne {
|
|
uuo.mutation.ClearOwner()
|
|
return uuo
|
|
}
|
|
|
|
// Where appends a list predicates to the UeUpdate builder.
|
|
func (uuo *UeUpdateOne) Where(ps ...predicate.Ue) *UeUpdateOne {
|
|
uuo.mutation.Where(ps...)
|
|
return uuo
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (uuo *UeUpdateOne) Select(field string, fields ...string) *UeUpdateOne {
|
|
uuo.fields = append([]string{field}, fields...)
|
|
return uuo
|
|
}
|
|
|
|
// Save executes the query and returns the updated Ue entity.
|
|
func (uuo *UeUpdateOne) Save(ctx context.Context) (*Ue, error) {
|
|
return withHooks[*Ue, UeMutation](ctx, uuo.sqlSave, uuo.mutation, uuo.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (uuo *UeUpdateOne) SaveX(ctx context.Context) *Ue {
|
|
node, err := uuo.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (uuo *UeUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := uuo.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (uuo *UeUpdateOne) ExecX(ctx context.Context) {
|
|
if err := uuo.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (uuo *UeUpdateOne) check() error {
|
|
if _, ok := uuo.mutation.OwnerID(); uuo.mutation.OwnerCleared() && !ok {
|
|
return errors.New(`ent: clearing a required unique edge "Ue.owner"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (uuo *UeUpdateOne) sqlSave(ctx context.Context) (_node *Ue, err error) {
|
|
if err := uuo.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(ue.Table, ue.Columns, sqlgraph.NewFieldSpec(ue.FieldID, field.TypeInt))
|
|
id, ok := uuo.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Ue.id" for update`)}
|
|
}
|
|
_spec.Node.ID.Value = id
|
|
if fields := uuo.fields; len(fields) > 0 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, ue.FieldID)
|
|
for _, f := range fields {
|
|
if !ue.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != ue.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := uuo.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := uuo.mutation.Limit(); ok {
|
|
_spec.SetField(ue.FieldLimit, field.TypeBool, value)
|
|
}
|
|
if uuo.mutation.LimitCleared() {
|
|
_spec.ClearField(ue.FieldLimit, field.TypeBool)
|
|
}
|
|
if value, ok := uuo.mutation.LimitBoss(); ok {
|
|
_spec.SetField(ue.FieldLimitBoss, field.TypeBool, value)
|
|
}
|
|
if uuo.mutation.LimitBossCleared() {
|
|
_spec.ClearField(ue.FieldLimitBoss, field.TypeBool)
|
|
}
|
|
if value, ok := uuo.mutation.LimitItem(); ok {
|
|
_spec.SetField(ue.FieldLimitItem, field.TypeBool, value)
|
|
}
|
|
if uuo.mutation.LimitItemCleared() {
|
|
_spec.ClearField(ue.FieldLimitItem, field.TypeBool)
|
|
}
|
|
if value, ok := uuo.mutation.Lv(); ok {
|
|
_spec.SetField(ue.FieldLv, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLv(); ok {
|
|
_spec.AddField(ue.FieldLv, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LvCleared() {
|
|
_spec.ClearField(ue.FieldLv, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.LvPoint(); ok {
|
|
_spec.SetField(ue.FieldLvPoint, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLvPoint(); ok {
|
|
_spec.AddField(ue.FieldLvPoint, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LvPointCleared() {
|
|
_spec.ClearField(ue.FieldLvPoint, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Model(); ok {
|
|
_spec.SetField(ue.FieldModel, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedModel(); ok {
|
|
_spec.AddField(ue.FieldModel, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.ModelCleared() {
|
|
_spec.ClearField(ue.FieldModel, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Sword(); ok {
|
|
_spec.SetField(ue.FieldSword, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedSword(); ok {
|
|
_spec.AddField(ue.FieldSword, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.SwordCleared() {
|
|
_spec.ClearField(ue.FieldSword, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Card(); ok {
|
|
_spec.SetField(ue.FieldCard, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedCard(); ok {
|
|
_spec.AddField(ue.FieldCard, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.CardCleared() {
|
|
_spec.ClearField(ue.FieldCard, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Mode(); ok {
|
|
_spec.SetField(ue.FieldMode, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.ModeCleared() {
|
|
_spec.ClearField(ue.FieldMode, field.TypeString)
|
|
}
|
|
if value, ok := uuo.mutation.Token(); ok {
|
|
_spec.SetField(ue.FieldToken, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.TokenCleared() {
|
|
_spec.ClearField(ue.FieldToken, field.TypeString)
|
|
}
|
|
if value, ok := uuo.mutation.Cp(); ok {
|
|
_spec.SetField(ue.FieldCp, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedCp(); ok {
|
|
_spec.AddField(ue.FieldCp, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.CpCleared() {
|
|
_spec.ClearField(ue.FieldCp, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Count(); ok {
|
|
_spec.SetField(ue.FieldCount, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedCount(); ok {
|
|
_spec.AddField(ue.FieldCount, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.CountCleared() {
|
|
_spec.ClearField(ue.FieldCount, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.LocationX(); ok {
|
|
_spec.SetField(ue.FieldLocationX, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLocationX(); ok {
|
|
_spec.AddField(ue.FieldLocationX, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LocationXCleared() {
|
|
_spec.ClearField(ue.FieldLocationX, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.LocationY(); ok {
|
|
_spec.SetField(ue.FieldLocationY, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLocationY(); ok {
|
|
_spec.AddField(ue.FieldLocationY, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LocationYCleared() {
|
|
_spec.ClearField(ue.FieldLocationY, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.LocationZ(); ok {
|
|
_spec.SetField(ue.FieldLocationZ, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLocationZ(); ok {
|
|
_spec.AddField(ue.FieldLocationZ, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LocationZCleared() {
|
|
_spec.ClearField(ue.FieldLocationZ, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.LocationN(); ok {
|
|
_spec.SetField(ue.FieldLocationN, field.TypeInt, value)
|
|
}
|
|
if value, ok := uuo.mutation.AddedLocationN(); ok {
|
|
_spec.AddField(ue.FieldLocationN, field.TypeInt, value)
|
|
}
|
|
if uuo.mutation.LocationNCleared() {
|
|
_spec.ClearField(ue.FieldLocationN, field.TypeInt)
|
|
}
|
|
if value, ok := uuo.mutation.Author(); ok {
|
|
_spec.SetField(ue.FieldAuthor, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.AuthorCleared() {
|
|
_spec.ClearField(ue.FieldAuthor, field.TypeString)
|
|
}
|
|
if value, ok := uuo.mutation.GameLv(); ok {
|
|
_spec.SetField(ue.FieldGameLv, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.GameLvCleared() {
|
|
_spec.ClearField(ue.FieldGameLv, field.TypeString)
|
|
}
|
|
if value, ok := uuo.mutation.GameExp(); ok {
|
|
_spec.SetField(ue.FieldGameExp, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.GameExpCleared() {
|
|
_spec.ClearField(ue.FieldGameExp, field.TypeString)
|
|
}
|
|
if value, ok := uuo.mutation.GameID(); ok {
|
|
_spec.SetField(ue.FieldGameID, field.TypeString, value)
|
|
}
|
|
if uuo.mutation.GameIDCleared() {
|
|
_spec.ClearField(ue.FieldGameID, field.TypeString)
|
|
}
|
|
if uuo.mutation.CreatedAtCleared() {
|
|
_spec.ClearField(ue.FieldCreatedAt, field.TypeTime)
|
|
}
|
|
if uuo.mutation.OwnerCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: ue.OwnerTable,
|
|
Columns: []string{ue.OwnerColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := uuo.mutation.OwnerIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: ue.OwnerTable,
|
|
Columns: []string{ue.OwnerColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_node = &Ue{config: uuo.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{ue.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
uuo.mutation.done = true
|
|
return _node, nil
|
|
}
|