8363 lines
224 KiB
Go
8363 lines
224 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"api/ent/card"
|
|
"api/ent/group"
|
|
"api/ent/predicate"
|
|
"api/ent/ue"
|
|
"api/ent/user"
|
|
"context"
|
|
"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.
|
|
TypeCard = "Card"
|
|
TypeGroup = "Group"
|
|
TypeUe = "Ue"
|
|
TypeUser = "User"
|
|
)
|
|
|
|
// CardMutation represents an operation that mutates the Card nodes in the graph.
|
|
type CardMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int
|
|
password *string
|
|
card *int
|
|
addcard *int
|
|
skill *string
|
|
status *string
|
|
token *string
|
|
cp *int
|
|
addcp *int
|
|
url *string
|
|
count *int
|
|
addcount *int
|
|
author *string
|
|
created_at *time.Time
|
|
clearedFields map[string]struct{}
|
|
owner *int
|
|
clearedowner bool
|
|
done bool
|
|
oldValue func(context.Context) (*Card, error)
|
|
predicates []predicate.Card
|
|
}
|
|
|
|
var _ ent.Mutation = (*CardMutation)(nil)
|
|
|
|
// cardOption allows management of the mutation configuration using functional options.
|
|
type cardOption func(*CardMutation)
|
|
|
|
// newCardMutation creates new mutation for the Card entity.
|
|
func newCardMutation(c config, op Op, opts ...cardOption) *CardMutation {
|
|
m := &CardMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeCard,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withCardID sets the ID field of the mutation.
|
|
func withCardID(id int) cardOption {
|
|
return func(m *CardMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *Card
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*Card, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().Card.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withCard sets the old Card of the mutation.
|
|
func withCard(node *Card) cardOption {
|
|
return func(m *CardMutation) {
|
|
m.oldValue = func(context.Context) (*Card, 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 CardMutation) 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 CardMutation) 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
|
|
}
|
|
|
|
// 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 *CardMutation) ID() (id int, 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 *CardMutation) IDs(ctx context.Context) ([]int, error) {
|
|
switch {
|
|
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
|
id, exists := m.ID()
|
|
if exists {
|
|
return []int{id}, nil
|
|
}
|
|
fallthrough
|
|
case m.op.Is(OpUpdate | OpDelete):
|
|
return m.Client().Card.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetPassword sets the "password" field.
|
|
func (m *CardMutation) SetPassword(s string) {
|
|
m.password = &s
|
|
}
|
|
|
|
// Password returns the value of the "password" field in the mutation.
|
|
func (m *CardMutation) Password() (r string, exists bool) {
|
|
v := m.password
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPassword returns the old "password" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldPassword(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPassword requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPassword: %w", err)
|
|
}
|
|
return oldValue.Password, nil
|
|
}
|
|
|
|
// ResetPassword resets all changes to the "password" field.
|
|
func (m *CardMutation) ResetPassword() {
|
|
m.password = nil
|
|
}
|
|
|
|
// SetCard sets the "card" field.
|
|
func (m *CardMutation) SetCard(i int) {
|
|
m.card = &i
|
|
m.addcard = nil
|
|
}
|
|
|
|
// Card returns the value of the "card" field in the mutation.
|
|
func (m *CardMutation) Card() (r int, exists bool) {
|
|
v := m.card
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCard returns the old "card" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldCard(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCard is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCard requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCard: %w", err)
|
|
}
|
|
return oldValue.Card, nil
|
|
}
|
|
|
|
// AddCard adds i to the "card" field.
|
|
func (m *CardMutation) AddCard(i int) {
|
|
if m.addcard != nil {
|
|
*m.addcard += i
|
|
} else {
|
|
m.addcard = &i
|
|
}
|
|
}
|
|
|
|
// AddedCard returns the value that was added to the "card" field in this mutation.
|
|
func (m *CardMutation) AddedCard() (r int, exists bool) {
|
|
v := m.addcard
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCard clears the value of the "card" field.
|
|
func (m *CardMutation) ClearCard() {
|
|
m.card = nil
|
|
m.addcard = nil
|
|
m.clearedFields[card.FieldCard] = struct{}{}
|
|
}
|
|
|
|
// CardCleared returns if the "card" field was cleared in this mutation.
|
|
func (m *CardMutation) CardCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldCard]
|
|
return ok
|
|
}
|
|
|
|
// ResetCard resets all changes to the "card" field.
|
|
func (m *CardMutation) ResetCard() {
|
|
m.card = nil
|
|
m.addcard = nil
|
|
delete(m.clearedFields, card.FieldCard)
|
|
}
|
|
|
|
// SetSkill sets the "skill" field.
|
|
func (m *CardMutation) SetSkill(s string) {
|
|
m.skill = &s
|
|
}
|
|
|
|
// Skill returns the value of the "skill" field in the mutation.
|
|
func (m *CardMutation) Skill() (r string, exists bool) {
|
|
v := m.skill
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldSkill returns the old "skill" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldSkill(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldSkill is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldSkill requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldSkill: %w", err)
|
|
}
|
|
return oldValue.Skill, nil
|
|
}
|
|
|
|
// ClearSkill clears the value of the "skill" field.
|
|
func (m *CardMutation) ClearSkill() {
|
|
m.skill = nil
|
|
m.clearedFields[card.FieldSkill] = struct{}{}
|
|
}
|
|
|
|
// SkillCleared returns if the "skill" field was cleared in this mutation.
|
|
func (m *CardMutation) SkillCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldSkill]
|
|
return ok
|
|
}
|
|
|
|
// ResetSkill resets all changes to the "skill" field.
|
|
func (m *CardMutation) ResetSkill() {
|
|
m.skill = nil
|
|
delete(m.clearedFields, card.FieldSkill)
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (m *CardMutation) SetStatus(s string) {
|
|
m.status = &s
|
|
}
|
|
|
|
// Status returns the value of the "status" field in the mutation.
|
|
func (m *CardMutation) Status() (r string, exists bool) {
|
|
v := m.status
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldStatus returns the old "status" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldStatus(ctx context.Context) (v string, 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
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (m *CardMutation) ClearStatus() {
|
|
m.status = nil
|
|
m.clearedFields[card.FieldStatus] = struct{}{}
|
|
}
|
|
|
|
// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
func (m *CardMutation) StatusCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldStatus]
|
|
return ok
|
|
}
|
|
|
|
// ResetStatus resets all changes to the "status" field.
|
|
func (m *CardMutation) ResetStatus() {
|
|
m.status = nil
|
|
delete(m.clearedFields, card.FieldStatus)
|
|
}
|
|
|
|
// SetToken sets the "token" field.
|
|
func (m *CardMutation) SetToken(s string) {
|
|
m.token = &s
|
|
}
|
|
|
|
// Token returns the value of the "token" field in the mutation.
|
|
func (m *CardMutation) Token() (r string, exists bool) {
|
|
v := m.token
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldToken returns the old "token" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldToken(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldToken is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldToken requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldToken: %w", err)
|
|
}
|
|
return oldValue.Token, nil
|
|
}
|
|
|
|
// ClearToken clears the value of the "token" field.
|
|
func (m *CardMutation) ClearToken() {
|
|
m.token = nil
|
|
m.clearedFields[card.FieldToken] = struct{}{}
|
|
}
|
|
|
|
// TokenCleared returns if the "token" field was cleared in this mutation.
|
|
func (m *CardMutation) TokenCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldToken]
|
|
return ok
|
|
}
|
|
|
|
// ResetToken resets all changes to the "token" field.
|
|
func (m *CardMutation) ResetToken() {
|
|
m.token = nil
|
|
delete(m.clearedFields, card.FieldToken)
|
|
}
|
|
|
|
// SetCp sets the "cp" field.
|
|
func (m *CardMutation) SetCp(i int) {
|
|
m.cp = &i
|
|
m.addcp = nil
|
|
}
|
|
|
|
// Cp returns the value of the "cp" field in the mutation.
|
|
func (m *CardMutation) Cp() (r int, exists bool) {
|
|
v := m.cp
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCp returns the old "cp" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldCp(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCp is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCp requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCp: %w", err)
|
|
}
|
|
return oldValue.Cp, nil
|
|
}
|
|
|
|
// AddCp adds i to the "cp" field.
|
|
func (m *CardMutation) AddCp(i int) {
|
|
if m.addcp != nil {
|
|
*m.addcp += i
|
|
} else {
|
|
m.addcp = &i
|
|
}
|
|
}
|
|
|
|
// AddedCp returns the value that was added to the "cp" field in this mutation.
|
|
func (m *CardMutation) AddedCp() (r int, exists bool) {
|
|
v := m.addcp
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCp clears the value of the "cp" field.
|
|
func (m *CardMutation) ClearCp() {
|
|
m.cp = nil
|
|
m.addcp = nil
|
|
m.clearedFields[card.FieldCp] = struct{}{}
|
|
}
|
|
|
|
// CpCleared returns if the "cp" field was cleared in this mutation.
|
|
func (m *CardMutation) CpCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldCp]
|
|
return ok
|
|
}
|
|
|
|
// ResetCp resets all changes to the "cp" field.
|
|
func (m *CardMutation) ResetCp() {
|
|
m.cp = nil
|
|
m.addcp = nil
|
|
delete(m.clearedFields, card.FieldCp)
|
|
}
|
|
|
|
// SetURL sets the "url" field.
|
|
func (m *CardMutation) SetURL(s string) {
|
|
m.url = &s
|
|
}
|
|
|
|
// URL returns the value of the "url" field in the mutation.
|
|
func (m *CardMutation) URL() (r string, exists bool) {
|
|
v := m.url
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldURL returns the old "url" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldURL(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldURL is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldURL requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldURL: %w", err)
|
|
}
|
|
return oldValue.URL, nil
|
|
}
|
|
|
|
// ClearURL clears the value of the "url" field.
|
|
func (m *CardMutation) ClearURL() {
|
|
m.url = nil
|
|
m.clearedFields[card.FieldURL] = struct{}{}
|
|
}
|
|
|
|
// URLCleared returns if the "url" field was cleared in this mutation.
|
|
func (m *CardMutation) URLCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldURL]
|
|
return ok
|
|
}
|
|
|
|
// ResetURL resets all changes to the "url" field.
|
|
func (m *CardMutation) ResetURL() {
|
|
m.url = nil
|
|
delete(m.clearedFields, card.FieldURL)
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (m *CardMutation) SetCount(i int) {
|
|
m.count = &i
|
|
m.addcount = nil
|
|
}
|
|
|
|
// Count returns the value of the "count" field in the mutation.
|
|
func (m *CardMutation) Count() (r int, exists bool) {
|
|
v := m.count
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCount returns the old "count" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldCount(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCount is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCount requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCount: %w", err)
|
|
}
|
|
return oldValue.Count, nil
|
|
}
|
|
|
|
// AddCount adds i to the "count" field.
|
|
func (m *CardMutation) AddCount(i int) {
|
|
if m.addcount != nil {
|
|
*m.addcount += i
|
|
} else {
|
|
m.addcount = &i
|
|
}
|
|
}
|
|
|
|
// AddedCount returns the value that was added to the "count" field in this mutation.
|
|
func (m *CardMutation) AddedCount() (r int, exists bool) {
|
|
v := m.addcount
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCount clears the value of the "count" field.
|
|
func (m *CardMutation) ClearCount() {
|
|
m.count = nil
|
|
m.addcount = nil
|
|
m.clearedFields[card.FieldCount] = struct{}{}
|
|
}
|
|
|
|
// CountCleared returns if the "count" field was cleared in this mutation.
|
|
func (m *CardMutation) CountCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldCount]
|
|
return ok
|
|
}
|
|
|
|
// ResetCount resets all changes to the "count" field.
|
|
func (m *CardMutation) ResetCount() {
|
|
m.count = nil
|
|
m.addcount = nil
|
|
delete(m.clearedFields, card.FieldCount)
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (m *CardMutation) SetAuthor(s string) {
|
|
m.author = &s
|
|
}
|
|
|
|
// Author returns the value of the "author" field in the mutation.
|
|
func (m *CardMutation) Author() (r string, exists bool) {
|
|
v := m.author
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldAuthor returns the old "author" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldAuthor(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldAuthor is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldAuthor requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldAuthor: %w", err)
|
|
}
|
|
return oldValue.Author, nil
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (m *CardMutation) ClearAuthor() {
|
|
m.author = nil
|
|
m.clearedFields[card.FieldAuthor] = struct{}{}
|
|
}
|
|
|
|
// AuthorCleared returns if the "author" field was cleared in this mutation.
|
|
func (m *CardMutation) AuthorCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldAuthor]
|
|
return ok
|
|
}
|
|
|
|
// ResetAuthor resets all changes to the "author" field.
|
|
func (m *CardMutation) ResetAuthor() {
|
|
m.author = nil
|
|
delete(m.clearedFields, card.FieldAuthor)
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *CardMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *CardMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the Card entity.
|
|
// If the Card 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 *CardMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
func (m *CardMutation) ClearCreatedAt() {
|
|
m.created_at = nil
|
|
m.clearedFields[card.FieldCreatedAt] = struct{}{}
|
|
}
|
|
|
|
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
|
func (m *CardMutation) CreatedAtCleared() bool {
|
|
_, ok := m.clearedFields[card.FieldCreatedAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *CardMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
delete(m.clearedFields, card.FieldCreatedAt)
|
|
}
|
|
|
|
// SetOwnerID sets the "owner" edge to the User entity by id.
|
|
func (m *CardMutation) SetOwnerID(id int) {
|
|
m.owner = &id
|
|
}
|
|
|
|
// ClearOwner clears the "owner" edge to the User entity.
|
|
func (m *CardMutation) ClearOwner() {
|
|
m.clearedowner = true
|
|
}
|
|
|
|
// OwnerCleared reports if the "owner" edge to the User entity was cleared.
|
|
func (m *CardMutation) OwnerCleared() bool {
|
|
return m.clearedowner
|
|
}
|
|
|
|
// OwnerID returns the "owner" edge ID in the mutation.
|
|
func (m *CardMutation) OwnerID() (id int, exists bool) {
|
|
if m.owner != nil {
|
|
return *m.owner, true
|
|
}
|
|
return
|
|
}
|
|
|
|
// OwnerIDs returns the "owner" edge IDs in the mutation.
|
|
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
// OwnerID instead. It exists only for internal usage by the builders.
|
|
func (m *CardMutation) OwnerIDs() (ids []int) {
|
|
if id := m.owner; id != nil {
|
|
ids = append(ids, *id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetOwner resets all changes to the "owner" edge.
|
|
func (m *CardMutation) ResetOwner() {
|
|
m.owner = nil
|
|
m.clearedowner = false
|
|
}
|
|
|
|
// Where appends a list predicates to the CardMutation builder.
|
|
func (m *CardMutation) Where(ps ...predicate.Card) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the CardMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *CardMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.Card, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *CardMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *CardMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (Card).
|
|
func (m *CardMutation) 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 *CardMutation) Fields() []string {
|
|
fields := make([]string, 0, 10)
|
|
if m.password != nil {
|
|
fields = append(fields, card.FieldPassword)
|
|
}
|
|
if m.card != nil {
|
|
fields = append(fields, card.FieldCard)
|
|
}
|
|
if m.skill != nil {
|
|
fields = append(fields, card.FieldSkill)
|
|
}
|
|
if m.status != nil {
|
|
fields = append(fields, card.FieldStatus)
|
|
}
|
|
if m.token != nil {
|
|
fields = append(fields, card.FieldToken)
|
|
}
|
|
if m.cp != nil {
|
|
fields = append(fields, card.FieldCp)
|
|
}
|
|
if m.url != nil {
|
|
fields = append(fields, card.FieldURL)
|
|
}
|
|
if m.count != nil {
|
|
fields = append(fields, card.FieldCount)
|
|
}
|
|
if m.author != nil {
|
|
fields = append(fields, card.FieldAuthor)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, card.FieldCreatedAt)
|
|
}
|
|
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 *CardMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case card.FieldPassword:
|
|
return m.Password()
|
|
case card.FieldCard:
|
|
return m.Card()
|
|
case card.FieldSkill:
|
|
return m.Skill()
|
|
case card.FieldStatus:
|
|
return m.Status()
|
|
case card.FieldToken:
|
|
return m.Token()
|
|
case card.FieldCp:
|
|
return m.Cp()
|
|
case card.FieldURL:
|
|
return m.URL()
|
|
case card.FieldCount:
|
|
return m.Count()
|
|
case card.FieldAuthor:
|
|
return m.Author()
|
|
case card.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
}
|
|
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 *CardMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case card.FieldPassword:
|
|
return m.OldPassword(ctx)
|
|
case card.FieldCard:
|
|
return m.OldCard(ctx)
|
|
case card.FieldSkill:
|
|
return m.OldSkill(ctx)
|
|
case card.FieldStatus:
|
|
return m.OldStatus(ctx)
|
|
case card.FieldToken:
|
|
return m.OldToken(ctx)
|
|
case card.FieldCp:
|
|
return m.OldCp(ctx)
|
|
case card.FieldURL:
|
|
return m.OldURL(ctx)
|
|
case card.FieldCount:
|
|
return m.OldCount(ctx)
|
|
case card.FieldAuthor:
|
|
return m.OldAuthor(ctx)
|
|
case card.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown Card 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 *CardMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case card.FieldPassword:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPassword(v)
|
|
return nil
|
|
case card.FieldCard:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCard(v)
|
|
return nil
|
|
case card.FieldSkill:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetSkill(v)
|
|
return nil
|
|
case card.FieldStatus:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetStatus(v)
|
|
return nil
|
|
case card.FieldToken:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetToken(v)
|
|
return nil
|
|
case card.FieldCp:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCp(v)
|
|
return nil
|
|
case card.FieldURL:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetURL(v)
|
|
return nil
|
|
case card.FieldCount:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCount(v)
|
|
return nil
|
|
case card.FieldAuthor:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetAuthor(v)
|
|
return nil
|
|
case card.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *CardMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.addcard != nil {
|
|
fields = append(fields, card.FieldCard)
|
|
}
|
|
if m.addcp != nil {
|
|
fields = append(fields, card.FieldCp)
|
|
}
|
|
if m.addcount != nil {
|
|
fields = append(fields, card.FieldCount)
|
|
}
|
|
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 *CardMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case card.FieldCard:
|
|
return m.AddedCard()
|
|
case card.FieldCp:
|
|
return m.AddedCp()
|
|
case card.FieldCount:
|
|
return m.AddedCount()
|
|
}
|
|
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 *CardMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case card.FieldCard:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCard(v)
|
|
return nil
|
|
case card.FieldCp:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCp(v)
|
|
return nil
|
|
case card.FieldCount:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCount(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *CardMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(card.FieldCard) {
|
|
fields = append(fields, card.FieldCard)
|
|
}
|
|
if m.FieldCleared(card.FieldSkill) {
|
|
fields = append(fields, card.FieldSkill)
|
|
}
|
|
if m.FieldCleared(card.FieldStatus) {
|
|
fields = append(fields, card.FieldStatus)
|
|
}
|
|
if m.FieldCleared(card.FieldToken) {
|
|
fields = append(fields, card.FieldToken)
|
|
}
|
|
if m.FieldCleared(card.FieldCp) {
|
|
fields = append(fields, card.FieldCp)
|
|
}
|
|
if m.FieldCleared(card.FieldURL) {
|
|
fields = append(fields, card.FieldURL)
|
|
}
|
|
if m.FieldCleared(card.FieldCount) {
|
|
fields = append(fields, card.FieldCount)
|
|
}
|
|
if m.FieldCleared(card.FieldAuthor) {
|
|
fields = append(fields, card.FieldAuthor)
|
|
}
|
|
if m.FieldCleared(card.FieldCreatedAt) {
|
|
fields = append(fields, card.FieldCreatedAt)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *CardMutation) 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 *CardMutation) ClearField(name string) error {
|
|
switch name {
|
|
case card.FieldCard:
|
|
m.ClearCard()
|
|
return nil
|
|
case card.FieldSkill:
|
|
m.ClearSkill()
|
|
return nil
|
|
case card.FieldStatus:
|
|
m.ClearStatus()
|
|
return nil
|
|
case card.FieldToken:
|
|
m.ClearToken()
|
|
return nil
|
|
case card.FieldCp:
|
|
m.ClearCp()
|
|
return nil
|
|
case card.FieldURL:
|
|
m.ClearURL()
|
|
return nil
|
|
case card.FieldCount:
|
|
m.ClearCount()
|
|
return nil
|
|
case card.FieldAuthor:
|
|
m.ClearAuthor()
|
|
return nil
|
|
case card.FieldCreatedAt:
|
|
m.ClearCreatedAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card 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 *CardMutation) ResetField(name string) error {
|
|
switch name {
|
|
case card.FieldPassword:
|
|
m.ResetPassword()
|
|
return nil
|
|
case card.FieldCard:
|
|
m.ResetCard()
|
|
return nil
|
|
case card.FieldSkill:
|
|
m.ResetSkill()
|
|
return nil
|
|
case card.FieldStatus:
|
|
m.ResetStatus()
|
|
return nil
|
|
case card.FieldToken:
|
|
m.ResetToken()
|
|
return nil
|
|
case card.FieldCp:
|
|
m.ResetCp()
|
|
return nil
|
|
case card.FieldURL:
|
|
m.ResetURL()
|
|
return nil
|
|
case card.FieldCount:
|
|
m.ResetCount()
|
|
return nil
|
|
case card.FieldAuthor:
|
|
m.ResetAuthor()
|
|
return nil
|
|
case card.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *CardMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.owner != nil {
|
|
edges = append(edges, card.EdgeOwner)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *CardMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case card.EdgeOwner:
|
|
if id := m.owner; id != nil {
|
|
return []ent.Value{*id}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *CardMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *CardMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *CardMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedowner {
|
|
edges = append(edges, card.EdgeOwner)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *CardMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case card.EdgeOwner:
|
|
return m.clearedowner
|
|
}
|
|
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 *CardMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
case card.EdgeOwner:
|
|
m.ClearOwner()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card 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 *CardMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case card.EdgeOwner:
|
|
m.ResetOwner()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Card edge %s", name)
|
|
}
|
|
|
|
// GroupMutation represents an operation that mutates the Group nodes in the graph.
|
|
type GroupMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int
|
|
name *string
|
|
password *string
|
|
clearedFields map[string]struct{}
|
|
users map[int]struct{}
|
|
removedusers map[int]struct{}
|
|
clearedusers bool
|
|
done bool
|
|
oldValue func(context.Context) (*Group, error)
|
|
predicates []predicate.Group
|
|
}
|
|
|
|
var _ ent.Mutation = (*GroupMutation)(nil)
|
|
|
|
// groupOption allows management of the mutation configuration using functional options.
|
|
type groupOption func(*GroupMutation)
|
|
|
|
// newGroupMutation creates new mutation for the Group entity.
|
|
func newGroupMutation(c config, op Op, opts ...groupOption) *GroupMutation {
|
|
m := &GroupMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeGroup,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withGroupID sets the ID field of the mutation.
|
|
func withGroupID(id int) groupOption {
|
|
return func(m *GroupMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *Group
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*Group, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().Group.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withGroup sets the old Group of the mutation.
|
|
func withGroup(node *Group) groupOption {
|
|
return func(m *GroupMutation) {
|
|
m.oldValue = func(context.Context) (*Group, 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 GroupMutation) 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 GroupMutation) 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
|
|
}
|
|
|
|
// 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 *GroupMutation) ID() (id int, 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 *GroupMutation) IDs(ctx context.Context) ([]int, error) {
|
|
switch {
|
|
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
|
id, exists := m.ID()
|
|
if exists {
|
|
return []int{id}, nil
|
|
}
|
|
fallthrough
|
|
case m.op.Is(OpUpdate | OpDelete):
|
|
return m.Client().Group.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (m *GroupMutation) SetName(s string) {
|
|
m.name = &s
|
|
}
|
|
|
|
// Name returns the value of the "name" field in the mutation.
|
|
func (m *GroupMutation) Name() (r string, exists bool) {
|
|
v := m.name
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldName returns the old "name" field's value of the Group entity.
|
|
// If the Group 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 *GroupMutation) OldName(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldName is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldName requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldName: %w", err)
|
|
}
|
|
return oldValue.Name, nil
|
|
}
|
|
|
|
// ResetName resets all changes to the "name" field.
|
|
func (m *GroupMutation) ResetName() {
|
|
m.name = nil
|
|
}
|
|
|
|
// SetPassword sets the "password" field.
|
|
func (m *GroupMutation) SetPassword(s string) {
|
|
m.password = &s
|
|
}
|
|
|
|
// Password returns the value of the "password" field in the mutation.
|
|
func (m *GroupMutation) Password() (r string, exists bool) {
|
|
v := m.password
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPassword returns the old "password" field's value of the Group entity.
|
|
// If the Group 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 *GroupMutation) OldPassword(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPassword requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPassword: %w", err)
|
|
}
|
|
return oldValue.Password, nil
|
|
}
|
|
|
|
// ResetPassword resets all changes to the "password" field.
|
|
func (m *GroupMutation) ResetPassword() {
|
|
m.password = nil
|
|
}
|
|
|
|
// AddUserIDs adds the "users" edge to the User entity by ids.
|
|
func (m *GroupMutation) AddUserIDs(ids ...int) {
|
|
if m.users == nil {
|
|
m.users = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.users[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearUsers clears the "users" edge to the User entity.
|
|
func (m *GroupMutation) ClearUsers() {
|
|
m.clearedusers = true
|
|
}
|
|
|
|
// UsersCleared reports if the "users" edge to the User entity was cleared.
|
|
func (m *GroupMutation) UsersCleared() bool {
|
|
return m.clearedusers
|
|
}
|
|
|
|
// RemoveUserIDs removes the "users" edge to the User entity by IDs.
|
|
func (m *GroupMutation) RemoveUserIDs(ids ...int) {
|
|
if m.removedusers == nil {
|
|
m.removedusers = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.users, ids[i])
|
|
m.removedusers[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedUsers returns the removed IDs of the "users" edge to the User entity.
|
|
func (m *GroupMutation) RemovedUsersIDs() (ids []int) {
|
|
for id := range m.removedusers {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// UsersIDs returns the "users" edge IDs in the mutation.
|
|
func (m *GroupMutation) UsersIDs() (ids []int) {
|
|
for id := range m.users {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetUsers resets all changes to the "users" edge.
|
|
func (m *GroupMutation) ResetUsers() {
|
|
m.users = nil
|
|
m.clearedusers = false
|
|
m.removedusers = nil
|
|
}
|
|
|
|
// Where appends a list predicates to the GroupMutation builder.
|
|
func (m *GroupMutation) Where(ps ...predicate.Group) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the GroupMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *GroupMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.Group, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *GroupMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *GroupMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (Group).
|
|
func (m *GroupMutation) 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 *GroupMutation) Fields() []string {
|
|
fields := make([]string, 0, 2)
|
|
if m.name != nil {
|
|
fields = append(fields, group.FieldName)
|
|
}
|
|
if m.password != nil {
|
|
fields = append(fields, group.FieldPassword)
|
|
}
|
|
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 *GroupMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case group.FieldName:
|
|
return m.Name()
|
|
case group.FieldPassword:
|
|
return m.Password()
|
|
}
|
|
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 *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case group.FieldName:
|
|
return m.OldName(ctx)
|
|
case group.FieldPassword:
|
|
return m.OldPassword(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown Group 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 *GroupMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case group.FieldName:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetName(v)
|
|
return nil
|
|
case group.FieldPassword:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPassword(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Group field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *GroupMutation) 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 *GroupMutation) 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 *GroupMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown Group numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *GroupMutation) ClearedFields() []string {
|
|
return nil
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *GroupMutation) 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 *GroupMutation) ClearField(name string) error {
|
|
return fmt.Errorf("unknown Group 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 *GroupMutation) ResetField(name string) error {
|
|
switch name {
|
|
case group.FieldName:
|
|
m.ResetName()
|
|
return nil
|
|
case group.FieldPassword:
|
|
m.ResetPassword()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Group field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *GroupMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.users != nil {
|
|
edges = append(edges, group.EdgeUsers)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *GroupMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case group.EdgeUsers:
|
|
ids := make([]ent.Value, 0, len(m.users))
|
|
for id := range m.users {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *GroupMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.removedusers != nil {
|
|
edges = append(edges, group.EdgeUsers)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *GroupMutation) RemovedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case group.EdgeUsers:
|
|
ids := make([]ent.Value, 0, len(m.removedusers))
|
|
for id := range m.removedusers {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *GroupMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedusers {
|
|
edges = append(edges, group.EdgeUsers)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *GroupMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case group.EdgeUsers:
|
|
return m.clearedusers
|
|
}
|
|
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 *GroupMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown Group 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 *GroupMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case group.EdgeUsers:
|
|
m.ResetUsers()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Group edge %s", name)
|
|
}
|
|
|
|
// UeMutation represents an operation that mutates the Ue nodes in the graph.
|
|
type UeMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int
|
|
_limit *bool
|
|
limit_boss *bool
|
|
limit_item *bool
|
|
password *string
|
|
lv *int
|
|
addlv *int
|
|
lv_point *int
|
|
addlv_point *int
|
|
model *int
|
|
addmodel *int
|
|
sword *int
|
|
addsword *int
|
|
card *int
|
|
addcard *int
|
|
mode *string
|
|
token *string
|
|
cp *int
|
|
addcp *int
|
|
count *int
|
|
addcount *int
|
|
location_x *int
|
|
addlocation_x *int
|
|
location_y *int
|
|
addlocation_y *int
|
|
location_z *int
|
|
addlocation_z *int
|
|
location_n *int
|
|
addlocation_n *int
|
|
author *string
|
|
created_at *time.Time
|
|
clearedFields map[string]struct{}
|
|
owner *int
|
|
clearedowner bool
|
|
done bool
|
|
oldValue func(context.Context) (*Ue, error)
|
|
predicates []predicate.Ue
|
|
}
|
|
|
|
var _ ent.Mutation = (*UeMutation)(nil)
|
|
|
|
// ueOption allows management of the mutation configuration using functional options.
|
|
type ueOption func(*UeMutation)
|
|
|
|
// newUeMutation creates new mutation for the Ue entity.
|
|
func newUeMutation(c config, op Op, opts ...ueOption) *UeMutation {
|
|
m := &UeMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeUe,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withUeID sets the ID field of the mutation.
|
|
func withUeID(id int) ueOption {
|
|
return func(m *UeMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *Ue
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*Ue, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().Ue.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withUe sets the old Ue of the mutation.
|
|
func withUe(node *Ue) ueOption {
|
|
return func(m *UeMutation) {
|
|
m.oldValue = func(context.Context) (*Ue, 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 UeMutation) 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 UeMutation) 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
|
|
}
|
|
|
|
// 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 *UeMutation) ID() (id int, 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 *UeMutation) IDs(ctx context.Context) ([]int, error) {
|
|
switch {
|
|
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
|
id, exists := m.ID()
|
|
if exists {
|
|
return []int{id}, nil
|
|
}
|
|
fallthrough
|
|
case m.op.Is(OpUpdate | OpDelete):
|
|
return m.Client().Ue.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetLimit sets the "limit" field.
|
|
func (m *UeMutation) SetLimit(b bool) {
|
|
m._limit = &b
|
|
}
|
|
|
|
// Limit returns the value of the "limit" field in the mutation.
|
|
func (m *UeMutation) Limit() (r bool, exists bool) {
|
|
v := m._limit
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLimit returns the old "limit" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLimit(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLimit is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLimit requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLimit: %w", err)
|
|
}
|
|
return oldValue.Limit, nil
|
|
}
|
|
|
|
// ClearLimit clears the value of the "limit" field.
|
|
func (m *UeMutation) ClearLimit() {
|
|
m._limit = nil
|
|
m.clearedFields[ue.FieldLimit] = struct{}{}
|
|
}
|
|
|
|
// LimitCleared returns if the "limit" field was cleared in this mutation.
|
|
func (m *UeMutation) LimitCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLimit]
|
|
return ok
|
|
}
|
|
|
|
// ResetLimit resets all changes to the "limit" field.
|
|
func (m *UeMutation) ResetLimit() {
|
|
m._limit = nil
|
|
delete(m.clearedFields, ue.FieldLimit)
|
|
}
|
|
|
|
// SetLimitBoss sets the "limit_boss" field.
|
|
func (m *UeMutation) SetLimitBoss(b bool) {
|
|
m.limit_boss = &b
|
|
}
|
|
|
|
// LimitBoss returns the value of the "limit_boss" field in the mutation.
|
|
func (m *UeMutation) LimitBoss() (r bool, exists bool) {
|
|
v := m.limit_boss
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLimitBoss returns the old "limit_boss" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLimitBoss(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLimitBoss is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLimitBoss requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLimitBoss: %w", err)
|
|
}
|
|
return oldValue.LimitBoss, nil
|
|
}
|
|
|
|
// ClearLimitBoss clears the value of the "limit_boss" field.
|
|
func (m *UeMutation) ClearLimitBoss() {
|
|
m.limit_boss = nil
|
|
m.clearedFields[ue.FieldLimitBoss] = struct{}{}
|
|
}
|
|
|
|
// LimitBossCleared returns if the "limit_boss" field was cleared in this mutation.
|
|
func (m *UeMutation) LimitBossCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLimitBoss]
|
|
return ok
|
|
}
|
|
|
|
// ResetLimitBoss resets all changes to the "limit_boss" field.
|
|
func (m *UeMutation) ResetLimitBoss() {
|
|
m.limit_boss = nil
|
|
delete(m.clearedFields, ue.FieldLimitBoss)
|
|
}
|
|
|
|
// SetLimitItem sets the "limit_item" field.
|
|
func (m *UeMutation) SetLimitItem(b bool) {
|
|
m.limit_item = &b
|
|
}
|
|
|
|
// LimitItem returns the value of the "limit_item" field in the mutation.
|
|
func (m *UeMutation) LimitItem() (r bool, exists bool) {
|
|
v := m.limit_item
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLimitItem returns the old "limit_item" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLimitItem(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLimitItem is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLimitItem requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLimitItem: %w", err)
|
|
}
|
|
return oldValue.LimitItem, nil
|
|
}
|
|
|
|
// ClearLimitItem clears the value of the "limit_item" field.
|
|
func (m *UeMutation) ClearLimitItem() {
|
|
m.limit_item = nil
|
|
m.clearedFields[ue.FieldLimitItem] = struct{}{}
|
|
}
|
|
|
|
// LimitItemCleared returns if the "limit_item" field was cleared in this mutation.
|
|
func (m *UeMutation) LimitItemCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLimitItem]
|
|
return ok
|
|
}
|
|
|
|
// ResetLimitItem resets all changes to the "limit_item" field.
|
|
func (m *UeMutation) ResetLimitItem() {
|
|
m.limit_item = nil
|
|
delete(m.clearedFields, ue.FieldLimitItem)
|
|
}
|
|
|
|
// SetPassword sets the "password" field.
|
|
func (m *UeMutation) SetPassword(s string) {
|
|
m.password = &s
|
|
}
|
|
|
|
// Password returns the value of the "password" field in the mutation.
|
|
func (m *UeMutation) Password() (r string, exists bool) {
|
|
v := m.password
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPassword returns the old "password" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldPassword(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPassword requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPassword: %w", err)
|
|
}
|
|
return oldValue.Password, nil
|
|
}
|
|
|
|
// ResetPassword resets all changes to the "password" field.
|
|
func (m *UeMutation) ResetPassword() {
|
|
m.password = nil
|
|
}
|
|
|
|
// SetLv sets the "lv" field.
|
|
func (m *UeMutation) SetLv(i int) {
|
|
m.lv = &i
|
|
m.addlv = nil
|
|
}
|
|
|
|
// Lv returns the value of the "lv" field in the mutation.
|
|
func (m *UeMutation) Lv() (r int, exists bool) {
|
|
v := m.lv
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLv returns the old "lv" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLv(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLv is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLv requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLv: %w", err)
|
|
}
|
|
return oldValue.Lv, nil
|
|
}
|
|
|
|
// AddLv adds i to the "lv" field.
|
|
func (m *UeMutation) AddLv(i int) {
|
|
if m.addlv != nil {
|
|
*m.addlv += i
|
|
} else {
|
|
m.addlv = &i
|
|
}
|
|
}
|
|
|
|
// AddedLv returns the value that was added to the "lv" field in this mutation.
|
|
func (m *UeMutation) AddedLv() (r int, exists bool) {
|
|
v := m.addlv
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLv clears the value of the "lv" field.
|
|
func (m *UeMutation) ClearLv() {
|
|
m.lv = nil
|
|
m.addlv = nil
|
|
m.clearedFields[ue.FieldLv] = struct{}{}
|
|
}
|
|
|
|
// LvCleared returns if the "lv" field was cleared in this mutation.
|
|
func (m *UeMutation) LvCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLv]
|
|
return ok
|
|
}
|
|
|
|
// ResetLv resets all changes to the "lv" field.
|
|
func (m *UeMutation) ResetLv() {
|
|
m.lv = nil
|
|
m.addlv = nil
|
|
delete(m.clearedFields, ue.FieldLv)
|
|
}
|
|
|
|
// SetLvPoint sets the "lv_point" field.
|
|
func (m *UeMutation) SetLvPoint(i int) {
|
|
m.lv_point = &i
|
|
m.addlv_point = nil
|
|
}
|
|
|
|
// LvPoint returns the value of the "lv_point" field in the mutation.
|
|
func (m *UeMutation) LvPoint() (r int, exists bool) {
|
|
v := m.lv_point
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLvPoint returns the old "lv_point" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLvPoint(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLvPoint is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLvPoint requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLvPoint: %w", err)
|
|
}
|
|
return oldValue.LvPoint, nil
|
|
}
|
|
|
|
// AddLvPoint adds i to the "lv_point" field.
|
|
func (m *UeMutation) AddLvPoint(i int) {
|
|
if m.addlv_point != nil {
|
|
*m.addlv_point += i
|
|
} else {
|
|
m.addlv_point = &i
|
|
}
|
|
}
|
|
|
|
// AddedLvPoint returns the value that was added to the "lv_point" field in this mutation.
|
|
func (m *UeMutation) AddedLvPoint() (r int, exists bool) {
|
|
v := m.addlv_point
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLvPoint clears the value of the "lv_point" field.
|
|
func (m *UeMutation) ClearLvPoint() {
|
|
m.lv_point = nil
|
|
m.addlv_point = nil
|
|
m.clearedFields[ue.FieldLvPoint] = struct{}{}
|
|
}
|
|
|
|
// LvPointCleared returns if the "lv_point" field was cleared in this mutation.
|
|
func (m *UeMutation) LvPointCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLvPoint]
|
|
return ok
|
|
}
|
|
|
|
// ResetLvPoint resets all changes to the "lv_point" field.
|
|
func (m *UeMutation) ResetLvPoint() {
|
|
m.lv_point = nil
|
|
m.addlv_point = nil
|
|
delete(m.clearedFields, ue.FieldLvPoint)
|
|
}
|
|
|
|
// SetModel sets the "model" field.
|
|
func (m *UeMutation) SetModel(i int) {
|
|
m.model = &i
|
|
m.addmodel = nil
|
|
}
|
|
|
|
// Model returns the value of the "model" field in the mutation.
|
|
func (m *UeMutation) Model() (r int, exists bool) {
|
|
v := m.model
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModel returns the old "model" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldModel(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModel is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModel requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModel: %w", err)
|
|
}
|
|
return oldValue.Model, nil
|
|
}
|
|
|
|
// AddModel adds i to the "model" field.
|
|
func (m *UeMutation) AddModel(i int) {
|
|
if m.addmodel != nil {
|
|
*m.addmodel += i
|
|
} else {
|
|
m.addmodel = &i
|
|
}
|
|
}
|
|
|
|
// AddedModel returns the value that was added to the "model" field in this mutation.
|
|
func (m *UeMutation) AddedModel() (r int, exists bool) {
|
|
v := m.addmodel
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModel clears the value of the "model" field.
|
|
func (m *UeMutation) ClearModel() {
|
|
m.model = nil
|
|
m.addmodel = nil
|
|
m.clearedFields[ue.FieldModel] = struct{}{}
|
|
}
|
|
|
|
// ModelCleared returns if the "model" field was cleared in this mutation.
|
|
func (m *UeMutation) ModelCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldModel]
|
|
return ok
|
|
}
|
|
|
|
// ResetModel resets all changes to the "model" field.
|
|
func (m *UeMutation) ResetModel() {
|
|
m.model = nil
|
|
m.addmodel = nil
|
|
delete(m.clearedFields, ue.FieldModel)
|
|
}
|
|
|
|
// SetSword sets the "sword" field.
|
|
func (m *UeMutation) SetSword(i int) {
|
|
m.sword = &i
|
|
m.addsword = nil
|
|
}
|
|
|
|
// Sword returns the value of the "sword" field in the mutation.
|
|
func (m *UeMutation) Sword() (r int, exists bool) {
|
|
v := m.sword
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldSword returns the old "sword" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldSword(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldSword is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldSword requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldSword: %w", err)
|
|
}
|
|
return oldValue.Sword, nil
|
|
}
|
|
|
|
// AddSword adds i to the "sword" field.
|
|
func (m *UeMutation) AddSword(i int) {
|
|
if m.addsword != nil {
|
|
*m.addsword += i
|
|
} else {
|
|
m.addsword = &i
|
|
}
|
|
}
|
|
|
|
// AddedSword returns the value that was added to the "sword" field in this mutation.
|
|
func (m *UeMutation) AddedSword() (r int, exists bool) {
|
|
v := m.addsword
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearSword clears the value of the "sword" field.
|
|
func (m *UeMutation) ClearSword() {
|
|
m.sword = nil
|
|
m.addsword = nil
|
|
m.clearedFields[ue.FieldSword] = struct{}{}
|
|
}
|
|
|
|
// SwordCleared returns if the "sword" field was cleared in this mutation.
|
|
func (m *UeMutation) SwordCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldSword]
|
|
return ok
|
|
}
|
|
|
|
// ResetSword resets all changes to the "sword" field.
|
|
func (m *UeMutation) ResetSword() {
|
|
m.sword = nil
|
|
m.addsword = nil
|
|
delete(m.clearedFields, ue.FieldSword)
|
|
}
|
|
|
|
// SetCard sets the "card" field.
|
|
func (m *UeMutation) SetCard(i int) {
|
|
m.card = &i
|
|
m.addcard = nil
|
|
}
|
|
|
|
// Card returns the value of the "card" field in the mutation.
|
|
func (m *UeMutation) Card() (r int, exists bool) {
|
|
v := m.card
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCard returns the old "card" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldCard(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCard is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCard requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCard: %w", err)
|
|
}
|
|
return oldValue.Card, nil
|
|
}
|
|
|
|
// AddCard adds i to the "card" field.
|
|
func (m *UeMutation) AddCard(i int) {
|
|
if m.addcard != nil {
|
|
*m.addcard += i
|
|
} else {
|
|
m.addcard = &i
|
|
}
|
|
}
|
|
|
|
// AddedCard returns the value that was added to the "card" field in this mutation.
|
|
func (m *UeMutation) AddedCard() (r int, exists bool) {
|
|
v := m.addcard
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCard clears the value of the "card" field.
|
|
func (m *UeMutation) ClearCard() {
|
|
m.card = nil
|
|
m.addcard = nil
|
|
m.clearedFields[ue.FieldCard] = struct{}{}
|
|
}
|
|
|
|
// CardCleared returns if the "card" field was cleared in this mutation.
|
|
func (m *UeMutation) CardCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldCard]
|
|
return ok
|
|
}
|
|
|
|
// ResetCard resets all changes to the "card" field.
|
|
func (m *UeMutation) ResetCard() {
|
|
m.card = nil
|
|
m.addcard = nil
|
|
delete(m.clearedFields, ue.FieldCard)
|
|
}
|
|
|
|
// SetMode sets the "mode" field.
|
|
func (m *UeMutation) SetMode(s string) {
|
|
m.mode = &s
|
|
}
|
|
|
|
// Mode returns the value of the "mode" field in the mutation.
|
|
func (m *UeMutation) Mode() (r string, exists bool) {
|
|
v := m.mode
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMode returns the old "mode" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldMode(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldMode is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldMode requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMode: %w", err)
|
|
}
|
|
return oldValue.Mode, nil
|
|
}
|
|
|
|
// ClearMode clears the value of the "mode" field.
|
|
func (m *UeMutation) ClearMode() {
|
|
m.mode = nil
|
|
m.clearedFields[ue.FieldMode] = struct{}{}
|
|
}
|
|
|
|
// ModeCleared returns if the "mode" field was cleared in this mutation.
|
|
func (m *UeMutation) ModeCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldMode]
|
|
return ok
|
|
}
|
|
|
|
// ResetMode resets all changes to the "mode" field.
|
|
func (m *UeMutation) ResetMode() {
|
|
m.mode = nil
|
|
delete(m.clearedFields, ue.FieldMode)
|
|
}
|
|
|
|
// SetToken sets the "token" field.
|
|
func (m *UeMutation) SetToken(s string) {
|
|
m.token = &s
|
|
}
|
|
|
|
// Token returns the value of the "token" field in the mutation.
|
|
func (m *UeMutation) Token() (r string, exists bool) {
|
|
v := m.token
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldToken returns the old "token" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldToken(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldToken is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldToken requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldToken: %w", err)
|
|
}
|
|
return oldValue.Token, nil
|
|
}
|
|
|
|
// ClearToken clears the value of the "token" field.
|
|
func (m *UeMutation) ClearToken() {
|
|
m.token = nil
|
|
m.clearedFields[ue.FieldToken] = struct{}{}
|
|
}
|
|
|
|
// TokenCleared returns if the "token" field was cleared in this mutation.
|
|
func (m *UeMutation) TokenCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldToken]
|
|
return ok
|
|
}
|
|
|
|
// ResetToken resets all changes to the "token" field.
|
|
func (m *UeMutation) ResetToken() {
|
|
m.token = nil
|
|
delete(m.clearedFields, ue.FieldToken)
|
|
}
|
|
|
|
// SetCp sets the "cp" field.
|
|
func (m *UeMutation) SetCp(i int) {
|
|
m.cp = &i
|
|
m.addcp = nil
|
|
}
|
|
|
|
// Cp returns the value of the "cp" field in the mutation.
|
|
func (m *UeMutation) Cp() (r int, exists bool) {
|
|
v := m.cp
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCp returns the old "cp" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldCp(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCp is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCp requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCp: %w", err)
|
|
}
|
|
return oldValue.Cp, nil
|
|
}
|
|
|
|
// AddCp adds i to the "cp" field.
|
|
func (m *UeMutation) AddCp(i int) {
|
|
if m.addcp != nil {
|
|
*m.addcp += i
|
|
} else {
|
|
m.addcp = &i
|
|
}
|
|
}
|
|
|
|
// AddedCp returns the value that was added to the "cp" field in this mutation.
|
|
func (m *UeMutation) AddedCp() (r int, exists bool) {
|
|
v := m.addcp
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCp clears the value of the "cp" field.
|
|
func (m *UeMutation) ClearCp() {
|
|
m.cp = nil
|
|
m.addcp = nil
|
|
m.clearedFields[ue.FieldCp] = struct{}{}
|
|
}
|
|
|
|
// CpCleared returns if the "cp" field was cleared in this mutation.
|
|
func (m *UeMutation) CpCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldCp]
|
|
return ok
|
|
}
|
|
|
|
// ResetCp resets all changes to the "cp" field.
|
|
func (m *UeMutation) ResetCp() {
|
|
m.cp = nil
|
|
m.addcp = nil
|
|
delete(m.clearedFields, ue.FieldCp)
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (m *UeMutation) SetCount(i int) {
|
|
m.count = &i
|
|
m.addcount = nil
|
|
}
|
|
|
|
// Count returns the value of the "count" field in the mutation.
|
|
func (m *UeMutation) Count() (r int, exists bool) {
|
|
v := m.count
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCount returns the old "count" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldCount(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCount is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCount requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCount: %w", err)
|
|
}
|
|
return oldValue.Count, nil
|
|
}
|
|
|
|
// AddCount adds i to the "count" field.
|
|
func (m *UeMutation) AddCount(i int) {
|
|
if m.addcount != nil {
|
|
*m.addcount += i
|
|
} else {
|
|
m.addcount = &i
|
|
}
|
|
}
|
|
|
|
// AddedCount returns the value that was added to the "count" field in this mutation.
|
|
func (m *UeMutation) AddedCount() (r int, exists bool) {
|
|
v := m.addcount
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCount clears the value of the "count" field.
|
|
func (m *UeMutation) ClearCount() {
|
|
m.count = nil
|
|
m.addcount = nil
|
|
m.clearedFields[ue.FieldCount] = struct{}{}
|
|
}
|
|
|
|
// CountCleared returns if the "count" field was cleared in this mutation.
|
|
func (m *UeMutation) CountCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldCount]
|
|
return ok
|
|
}
|
|
|
|
// ResetCount resets all changes to the "count" field.
|
|
func (m *UeMutation) ResetCount() {
|
|
m.count = nil
|
|
m.addcount = nil
|
|
delete(m.clearedFields, ue.FieldCount)
|
|
}
|
|
|
|
// SetLocationX sets the "location_x" field.
|
|
func (m *UeMutation) SetLocationX(i int) {
|
|
m.location_x = &i
|
|
m.addlocation_x = nil
|
|
}
|
|
|
|
// LocationX returns the value of the "location_x" field in the mutation.
|
|
func (m *UeMutation) LocationX() (r int, exists bool) {
|
|
v := m.location_x
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocationX returns the old "location_x" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLocationX(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocationX is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocationX requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocationX: %w", err)
|
|
}
|
|
return oldValue.LocationX, nil
|
|
}
|
|
|
|
// AddLocationX adds i to the "location_x" field.
|
|
func (m *UeMutation) AddLocationX(i int) {
|
|
if m.addlocation_x != nil {
|
|
*m.addlocation_x += i
|
|
} else {
|
|
m.addlocation_x = &i
|
|
}
|
|
}
|
|
|
|
// AddedLocationX returns the value that was added to the "location_x" field in this mutation.
|
|
func (m *UeMutation) AddedLocationX() (r int, exists bool) {
|
|
v := m.addlocation_x
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLocationX clears the value of the "location_x" field.
|
|
func (m *UeMutation) ClearLocationX() {
|
|
m.location_x = nil
|
|
m.addlocation_x = nil
|
|
m.clearedFields[ue.FieldLocationX] = struct{}{}
|
|
}
|
|
|
|
// LocationXCleared returns if the "location_x" field was cleared in this mutation.
|
|
func (m *UeMutation) LocationXCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLocationX]
|
|
return ok
|
|
}
|
|
|
|
// ResetLocationX resets all changes to the "location_x" field.
|
|
func (m *UeMutation) ResetLocationX() {
|
|
m.location_x = nil
|
|
m.addlocation_x = nil
|
|
delete(m.clearedFields, ue.FieldLocationX)
|
|
}
|
|
|
|
// SetLocationY sets the "location_y" field.
|
|
func (m *UeMutation) SetLocationY(i int) {
|
|
m.location_y = &i
|
|
m.addlocation_y = nil
|
|
}
|
|
|
|
// LocationY returns the value of the "location_y" field in the mutation.
|
|
func (m *UeMutation) LocationY() (r int, exists bool) {
|
|
v := m.location_y
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocationY returns the old "location_y" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLocationY(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocationY is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocationY requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocationY: %w", err)
|
|
}
|
|
return oldValue.LocationY, nil
|
|
}
|
|
|
|
// AddLocationY adds i to the "location_y" field.
|
|
func (m *UeMutation) AddLocationY(i int) {
|
|
if m.addlocation_y != nil {
|
|
*m.addlocation_y += i
|
|
} else {
|
|
m.addlocation_y = &i
|
|
}
|
|
}
|
|
|
|
// AddedLocationY returns the value that was added to the "location_y" field in this mutation.
|
|
func (m *UeMutation) AddedLocationY() (r int, exists bool) {
|
|
v := m.addlocation_y
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLocationY clears the value of the "location_y" field.
|
|
func (m *UeMutation) ClearLocationY() {
|
|
m.location_y = nil
|
|
m.addlocation_y = nil
|
|
m.clearedFields[ue.FieldLocationY] = struct{}{}
|
|
}
|
|
|
|
// LocationYCleared returns if the "location_y" field was cleared in this mutation.
|
|
func (m *UeMutation) LocationYCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLocationY]
|
|
return ok
|
|
}
|
|
|
|
// ResetLocationY resets all changes to the "location_y" field.
|
|
func (m *UeMutation) ResetLocationY() {
|
|
m.location_y = nil
|
|
m.addlocation_y = nil
|
|
delete(m.clearedFields, ue.FieldLocationY)
|
|
}
|
|
|
|
// SetLocationZ sets the "location_z" field.
|
|
func (m *UeMutation) SetLocationZ(i int) {
|
|
m.location_z = &i
|
|
m.addlocation_z = nil
|
|
}
|
|
|
|
// LocationZ returns the value of the "location_z" field in the mutation.
|
|
func (m *UeMutation) LocationZ() (r int, exists bool) {
|
|
v := m.location_z
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocationZ returns the old "location_z" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLocationZ(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocationZ is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocationZ requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocationZ: %w", err)
|
|
}
|
|
return oldValue.LocationZ, nil
|
|
}
|
|
|
|
// AddLocationZ adds i to the "location_z" field.
|
|
func (m *UeMutation) AddLocationZ(i int) {
|
|
if m.addlocation_z != nil {
|
|
*m.addlocation_z += i
|
|
} else {
|
|
m.addlocation_z = &i
|
|
}
|
|
}
|
|
|
|
// AddedLocationZ returns the value that was added to the "location_z" field in this mutation.
|
|
func (m *UeMutation) AddedLocationZ() (r int, exists bool) {
|
|
v := m.addlocation_z
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLocationZ clears the value of the "location_z" field.
|
|
func (m *UeMutation) ClearLocationZ() {
|
|
m.location_z = nil
|
|
m.addlocation_z = nil
|
|
m.clearedFields[ue.FieldLocationZ] = struct{}{}
|
|
}
|
|
|
|
// LocationZCleared returns if the "location_z" field was cleared in this mutation.
|
|
func (m *UeMutation) LocationZCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLocationZ]
|
|
return ok
|
|
}
|
|
|
|
// ResetLocationZ resets all changes to the "location_z" field.
|
|
func (m *UeMutation) ResetLocationZ() {
|
|
m.location_z = nil
|
|
m.addlocation_z = nil
|
|
delete(m.clearedFields, ue.FieldLocationZ)
|
|
}
|
|
|
|
// SetLocationN sets the "location_n" field.
|
|
func (m *UeMutation) SetLocationN(i int) {
|
|
m.location_n = &i
|
|
m.addlocation_n = nil
|
|
}
|
|
|
|
// LocationN returns the value of the "location_n" field in the mutation.
|
|
func (m *UeMutation) LocationN() (r int, exists bool) {
|
|
v := m.location_n
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLocationN returns the old "location_n" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldLocationN(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLocationN is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLocationN requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLocationN: %w", err)
|
|
}
|
|
return oldValue.LocationN, nil
|
|
}
|
|
|
|
// AddLocationN adds i to the "location_n" field.
|
|
func (m *UeMutation) AddLocationN(i int) {
|
|
if m.addlocation_n != nil {
|
|
*m.addlocation_n += i
|
|
} else {
|
|
m.addlocation_n = &i
|
|
}
|
|
}
|
|
|
|
// AddedLocationN returns the value that was added to the "location_n" field in this mutation.
|
|
func (m *UeMutation) AddedLocationN() (r int, exists bool) {
|
|
v := m.addlocation_n
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLocationN clears the value of the "location_n" field.
|
|
func (m *UeMutation) ClearLocationN() {
|
|
m.location_n = nil
|
|
m.addlocation_n = nil
|
|
m.clearedFields[ue.FieldLocationN] = struct{}{}
|
|
}
|
|
|
|
// LocationNCleared returns if the "location_n" field was cleared in this mutation.
|
|
func (m *UeMutation) LocationNCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldLocationN]
|
|
return ok
|
|
}
|
|
|
|
// ResetLocationN resets all changes to the "location_n" field.
|
|
func (m *UeMutation) ResetLocationN() {
|
|
m.location_n = nil
|
|
m.addlocation_n = nil
|
|
delete(m.clearedFields, ue.FieldLocationN)
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (m *UeMutation) SetAuthor(s string) {
|
|
m.author = &s
|
|
}
|
|
|
|
// Author returns the value of the "author" field in the mutation.
|
|
func (m *UeMutation) Author() (r string, exists bool) {
|
|
v := m.author
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldAuthor returns the old "author" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldAuthor(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldAuthor is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldAuthor requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldAuthor: %w", err)
|
|
}
|
|
return oldValue.Author, nil
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (m *UeMutation) ClearAuthor() {
|
|
m.author = nil
|
|
m.clearedFields[ue.FieldAuthor] = struct{}{}
|
|
}
|
|
|
|
// AuthorCleared returns if the "author" field was cleared in this mutation.
|
|
func (m *UeMutation) AuthorCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldAuthor]
|
|
return ok
|
|
}
|
|
|
|
// ResetAuthor resets all changes to the "author" field.
|
|
func (m *UeMutation) ResetAuthor() {
|
|
m.author = nil
|
|
delete(m.clearedFields, ue.FieldAuthor)
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *UeMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *UeMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the Ue entity.
|
|
// If the Ue 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 *UeMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
func (m *UeMutation) ClearCreatedAt() {
|
|
m.created_at = nil
|
|
m.clearedFields[ue.FieldCreatedAt] = struct{}{}
|
|
}
|
|
|
|
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
|
func (m *UeMutation) CreatedAtCleared() bool {
|
|
_, ok := m.clearedFields[ue.FieldCreatedAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *UeMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
delete(m.clearedFields, ue.FieldCreatedAt)
|
|
}
|
|
|
|
// SetOwnerID sets the "owner" edge to the User entity by id.
|
|
func (m *UeMutation) SetOwnerID(id int) {
|
|
m.owner = &id
|
|
}
|
|
|
|
// ClearOwner clears the "owner" edge to the User entity.
|
|
func (m *UeMutation) ClearOwner() {
|
|
m.clearedowner = true
|
|
}
|
|
|
|
// OwnerCleared reports if the "owner" edge to the User entity was cleared.
|
|
func (m *UeMutation) OwnerCleared() bool {
|
|
return m.clearedowner
|
|
}
|
|
|
|
// OwnerID returns the "owner" edge ID in the mutation.
|
|
func (m *UeMutation) OwnerID() (id int, exists bool) {
|
|
if m.owner != nil {
|
|
return *m.owner, true
|
|
}
|
|
return
|
|
}
|
|
|
|
// OwnerIDs returns the "owner" edge IDs in the mutation.
|
|
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
// OwnerID instead. It exists only for internal usage by the builders.
|
|
func (m *UeMutation) OwnerIDs() (ids []int) {
|
|
if id := m.owner; id != nil {
|
|
ids = append(ids, *id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetOwner resets all changes to the "owner" edge.
|
|
func (m *UeMutation) ResetOwner() {
|
|
m.owner = nil
|
|
m.clearedowner = false
|
|
}
|
|
|
|
// Where appends a list predicates to the UeMutation builder.
|
|
func (m *UeMutation) Where(ps ...predicate.Ue) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the UeMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *UeMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.Ue, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *UeMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *UeMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (Ue).
|
|
func (m *UeMutation) 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 *UeMutation) Fields() []string {
|
|
fields := make([]string, 0, 19)
|
|
if m._limit != nil {
|
|
fields = append(fields, ue.FieldLimit)
|
|
}
|
|
if m.limit_boss != nil {
|
|
fields = append(fields, ue.FieldLimitBoss)
|
|
}
|
|
if m.limit_item != nil {
|
|
fields = append(fields, ue.FieldLimitItem)
|
|
}
|
|
if m.password != nil {
|
|
fields = append(fields, ue.FieldPassword)
|
|
}
|
|
if m.lv != nil {
|
|
fields = append(fields, ue.FieldLv)
|
|
}
|
|
if m.lv_point != nil {
|
|
fields = append(fields, ue.FieldLvPoint)
|
|
}
|
|
if m.model != nil {
|
|
fields = append(fields, ue.FieldModel)
|
|
}
|
|
if m.sword != nil {
|
|
fields = append(fields, ue.FieldSword)
|
|
}
|
|
if m.card != nil {
|
|
fields = append(fields, ue.FieldCard)
|
|
}
|
|
if m.mode != nil {
|
|
fields = append(fields, ue.FieldMode)
|
|
}
|
|
if m.token != nil {
|
|
fields = append(fields, ue.FieldToken)
|
|
}
|
|
if m.cp != nil {
|
|
fields = append(fields, ue.FieldCp)
|
|
}
|
|
if m.count != nil {
|
|
fields = append(fields, ue.FieldCount)
|
|
}
|
|
if m.location_x != nil {
|
|
fields = append(fields, ue.FieldLocationX)
|
|
}
|
|
if m.location_y != nil {
|
|
fields = append(fields, ue.FieldLocationY)
|
|
}
|
|
if m.location_z != nil {
|
|
fields = append(fields, ue.FieldLocationZ)
|
|
}
|
|
if m.location_n != nil {
|
|
fields = append(fields, ue.FieldLocationN)
|
|
}
|
|
if m.author != nil {
|
|
fields = append(fields, ue.FieldAuthor)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, ue.FieldCreatedAt)
|
|
}
|
|
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 *UeMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case ue.FieldLimit:
|
|
return m.Limit()
|
|
case ue.FieldLimitBoss:
|
|
return m.LimitBoss()
|
|
case ue.FieldLimitItem:
|
|
return m.LimitItem()
|
|
case ue.FieldPassword:
|
|
return m.Password()
|
|
case ue.FieldLv:
|
|
return m.Lv()
|
|
case ue.FieldLvPoint:
|
|
return m.LvPoint()
|
|
case ue.FieldModel:
|
|
return m.Model()
|
|
case ue.FieldSword:
|
|
return m.Sword()
|
|
case ue.FieldCard:
|
|
return m.Card()
|
|
case ue.FieldMode:
|
|
return m.Mode()
|
|
case ue.FieldToken:
|
|
return m.Token()
|
|
case ue.FieldCp:
|
|
return m.Cp()
|
|
case ue.FieldCount:
|
|
return m.Count()
|
|
case ue.FieldLocationX:
|
|
return m.LocationX()
|
|
case ue.FieldLocationY:
|
|
return m.LocationY()
|
|
case ue.FieldLocationZ:
|
|
return m.LocationZ()
|
|
case ue.FieldLocationN:
|
|
return m.LocationN()
|
|
case ue.FieldAuthor:
|
|
return m.Author()
|
|
case ue.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
}
|
|
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 *UeMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case ue.FieldLimit:
|
|
return m.OldLimit(ctx)
|
|
case ue.FieldLimitBoss:
|
|
return m.OldLimitBoss(ctx)
|
|
case ue.FieldLimitItem:
|
|
return m.OldLimitItem(ctx)
|
|
case ue.FieldPassword:
|
|
return m.OldPassword(ctx)
|
|
case ue.FieldLv:
|
|
return m.OldLv(ctx)
|
|
case ue.FieldLvPoint:
|
|
return m.OldLvPoint(ctx)
|
|
case ue.FieldModel:
|
|
return m.OldModel(ctx)
|
|
case ue.FieldSword:
|
|
return m.OldSword(ctx)
|
|
case ue.FieldCard:
|
|
return m.OldCard(ctx)
|
|
case ue.FieldMode:
|
|
return m.OldMode(ctx)
|
|
case ue.FieldToken:
|
|
return m.OldToken(ctx)
|
|
case ue.FieldCp:
|
|
return m.OldCp(ctx)
|
|
case ue.FieldCount:
|
|
return m.OldCount(ctx)
|
|
case ue.FieldLocationX:
|
|
return m.OldLocationX(ctx)
|
|
case ue.FieldLocationY:
|
|
return m.OldLocationY(ctx)
|
|
case ue.FieldLocationZ:
|
|
return m.OldLocationZ(ctx)
|
|
case ue.FieldLocationN:
|
|
return m.OldLocationN(ctx)
|
|
case ue.FieldAuthor:
|
|
return m.OldAuthor(ctx)
|
|
case ue.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown Ue 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 *UeMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case ue.FieldLimit:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLimit(v)
|
|
return nil
|
|
case ue.FieldLimitBoss:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLimitBoss(v)
|
|
return nil
|
|
case ue.FieldLimitItem:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLimitItem(v)
|
|
return nil
|
|
case ue.FieldPassword:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPassword(v)
|
|
return nil
|
|
case ue.FieldLv:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLv(v)
|
|
return nil
|
|
case ue.FieldLvPoint:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLvPoint(v)
|
|
return nil
|
|
case ue.FieldModel:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModel(v)
|
|
return nil
|
|
case ue.FieldSword:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetSword(v)
|
|
return nil
|
|
case ue.FieldCard:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCard(v)
|
|
return nil
|
|
case ue.FieldMode:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMode(v)
|
|
return nil
|
|
case ue.FieldToken:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetToken(v)
|
|
return nil
|
|
case ue.FieldCp:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCp(v)
|
|
return nil
|
|
case ue.FieldCount:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCount(v)
|
|
return nil
|
|
case ue.FieldLocationX:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocationX(v)
|
|
return nil
|
|
case ue.FieldLocationY:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocationY(v)
|
|
return nil
|
|
case ue.FieldLocationZ:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocationZ(v)
|
|
return nil
|
|
case ue.FieldLocationN:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLocationN(v)
|
|
return nil
|
|
case ue.FieldAuthor:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetAuthor(v)
|
|
return nil
|
|
case ue.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *UeMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.addlv != nil {
|
|
fields = append(fields, ue.FieldLv)
|
|
}
|
|
if m.addlv_point != nil {
|
|
fields = append(fields, ue.FieldLvPoint)
|
|
}
|
|
if m.addmodel != nil {
|
|
fields = append(fields, ue.FieldModel)
|
|
}
|
|
if m.addsword != nil {
|
|
fields = append(fields, ue.FieldSword)
|
|
}
|
|
if m.addcard != nil {
|
|
fields = append(fields, ue.FieldCard)
|
|
}
|
|
if m.addcp != nil {
|
|
fields = append(fields, ue.FieldCp)
|
|
}
|
|
if m.addcount != nil {
|
|
fields = append(fields, ue.FieldCount)
|
|
}
|
|
if m.addlocation_x != nil {
|
|
fields = append(fields, ue.FieldLocationX)
|
|
}
|
|
if m.addlocation_y != nil {
|
|
fields = append(fields, ue.FieldLocationY)
|
|
}
|
|
if m.addlocation_z != nil {
|
|
fields = append(fields, ue.FieldLocationZ)
|
|
}
|
|
if m.addlocation_n != nil {
|
|
fields = append(fields, ue.FieldLocationN)
|
|
}
|
|
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 *UeMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case ue.FieldLv:
|
|
return m.AddedLv()
|
|
case ue.FieldLvPoint:
|
|
return m.AddedLvPoint()
|
|
case ue.FieldModel:
|
|
return m.AddedModel()
|
|
case ue.FieldSword:
|
|
return m.AddedSword()
|
|
case ue.FieldCard:
|
|
return m.AddedCard()
|
|
case ue.FieldCp:
|
|
return m.AddedCp()
|
|
case ue.FieldCount:
|
|
return m.AddedCount()
|
|
case ue.FieldLocationX:
|
|
return m.AddedLocationX()
|
|
case ue.FieldLocationY:
|
|
return m.AddedLocationY()
|
|
case ue.FieldLocationZ:
|
|
return m.AddedLocationZ()
|
|
case ue.FieldLocationN:
|
|
return m.AddedLocationN()
|
|
}
|
|
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 *UeMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case ue.FieldLv:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLv(v)
|
|
return nil
|
|
case ue.FieldLvPoint:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLvPoint(v)
|
|
return nil
|
|
case ue.FieldModel:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModel(v)
|
|
return nil
|
|
case ue.FieldSword:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddSword(v)
|
|
return nil
|
|
case ue.FieldCard:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCard(v)
|
|
return nil
|
|
case ue.FieldCp:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCp(v)
|
|
return nil
|
|
case ue.FieldCount:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCount(v)
|
|
return nil
|
|
case ue.FieldLocationX:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLocationX(v)
|
|
return nil
|
|
case ue.FieldLocationY:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLocationY(v)
|
|
return nil
|
|
case ue.FieldLocationZ:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLocationZ(v)
|
|
return nil
|
|
case ue.FieldLocationN:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLocationN(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *UeMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(ue.FieldLimit) {
|
|
fields = append(fields, ue.FieldLimit)
|
|
}
|
|
if m.FieldCleared(ue.FieldLimitBoss) {
|
|
fields = append(fields, ue.FieldLimitBoss)
|
|
}
|
|
if m.FieldCleared(ue.FieldLimitItem) {
|
|
fields = append(fields, ue.FieldLimitItem)
|
|
}
|
|
if m.FieldCleared(ue.FieldLv) {
|
|
fields = append(fields, ue.FieldLv)
|
|
}
|
|
if m.FieldCleared(ue.FieldLvPoint) {
|
|
fields = append(fields, ue.FieldLvPoint)
|
|
}
|
|
if m.FieldCleared(ue.FieldModel) {
|
|
fields = append(fields, ue.FieldModel)
|
|
}
|
|
if m.FieldCleared(ue.FieldSword) {
|
|
fields = append(fields, ue.FieldSword)
|
|
}
|
|
if m.FieldCleared(ue.FieldCard) {
|
|
fields = append(fields, ue.FieldCard)
|
|
}
|
|
if m.FieldCleared(ue.FieldMode) {
|
|
fields = append(fields, ue.FieldMode)
|
|
}
|
|
if m.FieldCleared(ue.FieldToken) {
|
|
fields = append(fields, ue.FieldToken)
|
|
}
|
|
if m.FieldCleared(ue.FieldCp) {
|
|
fields = append(fields, ue.FieldCp)
|
|
}
|
|
if m.FieldCleared(ue.FieldCount) {
|
|
fields = append(fields, ue.FieldCount)
|
|
}
|
|
if m.FieldCleared(ue.FieldLocationX) {
|
|
fields = append(fields, ue.FieldLocationX)
|
|
}
|
|
if m.FieldCleared(ue.FieldLocationY) {
|
|
fields = append(fields, ue.FieldLocationY)
|
|
}
|
|
if m.FieldCleared(ue.FieldLocationZ) {
|
|
fields = append(fields, ue.FieldLocationZ)
|
|
}
|
|
if m.FieldCleared(ue.FieldLocationN) {
|
|
fields = append(fields, ue.FieldLocationN)
|
|
}
|
|
if m.FieldCleared(ue.FieldAuthor) {
|
|
fields = append(fields, ue.FieldAuthor)
|
|
}
|
|
if m.FieldCleared(ue.FieldCreatedAt) {
|
|
fields = append(fields, ue.FieldCreatedAt)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *UeMutation) 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 *UeMutation) ClearField(name string) error {
|
|
switch name {
|
|
case ue.FieldLimit:
|
|
m.ClearLimit()
|
|
return nil
|
|
case ue.FieldLimitBoss:
|
|
m.ClearLimitBoss()
|
|
return nil
|
|
case ue.FieldLimitItem:
|
|
m.ClearLimitItem()
|
|
return nil
|
|
case ue.FieldLv:
|
|
m.ClearLv()
|
|
return nil
|
|
case ue.FieldLvPoint:
|
|
m.ClearLvPoint()
|
|
return nil
|
|
case ue.FieldModel:
|
|
m.ClearModel()
|
|
return nil
|
|
case ue.FieldSword:
|
|
m.ClearSword()
|
|
return nil
|
|
case ue.FieldCard:
|
|
m.ClearCard()
|
|
return nil
|
|
case ue.FieldMode:
|
|
m.ClearMode()
|
|
return nil
|
|
case ue.FieldToken:
|
|
m.ClearToken()
|
|
return nil
|
|
case ue.FieldCp:
|
|
m.ClearCp()
|
|
return nil
|
|
case ue.FieldCount:
|
|
m.ClearCount()
|
|
return nil
|
|
case ue.FieldLocationX:
|
|
m.ClearLocationX()
|
|
return nil
|
|
case ue.FieldLocationY:
|
|
m.ClearLocationY()
|
|
return nil
|
|
case ue.FieldLocationZ:
|
|
m.ClearLocationZ()
|
|
return nil
|
|
case ue.FieldLocationN:
|
|
m.ClearLocationN()
|
|
return nil
|
|
case ue.FieldAuthor:
|
|
m.ClearAuthor()
|
|
return nil
|
|
case ue.FieldCreatedAt:
|
|
m.ClearCreatedAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue 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 *UeMutation) ResetField(name string) error {
|
|
switch name {
|
|
case ue.FieldLimit:
|
|
m.ResetLimit()
|
|
return nil
|
|
case ue.FieldLimitBoss:
|
|
m.ResetLimitBoss()
|
|
return nil
|
|
case ue.FieldLimitItem:
|
|
m.ResetLimitItem()
|
|
return nil
|
|
case ue.FieldPassword:
|
|
m.ResetPassword()
|
|
return nil
|
|
case ue.FieldLv:
|
|
m.ResetLv()
|
|
return nil
|
|
case ue.FieldLvPoint:
|
|
m.ResetLvPoint()
|
|
return nil
|
|
case ue.FieldModel:
|
|
m.ResetModel()
|
|
return nil
|
|
case ue.FieldSword:
|
|
m.ResetSword()
|
|
return nil
|
|
case ue.FieldCard:
|
|
m.ResetCard()
|
|
return nil
|
|
case ue.FieldMode:
|
|
m.ResetMode()
|
|
return nil
|
|
case ue.FieldToken:
|
|
m.ResetToken()
|
|
return nil
|
|
case ue.FieldCp:
|
|
m.ResetCp()
|
|
return nil
|
|
case ue.FieldCount:
|
|
m.ResetCount()
|
|
return nil
|
|
case ue.FieldLocationX:
|
|
m.ResetLocationX()
|
|
return nil
|
|
case ue.FieldLocationY:
|
|
m.ResetLocationY()
|
|
return nil
|
|
case ue.FieldLocationZ:
|
|
m.ResetLocationZ()
|
|
return nil
|
|
case ue.FieldLocationN:
|
|
m.ResetLocationN()
|
|
return nil
|
|
case ue.FieldAuthor:
|
|
m.ResetAuthor()
|
|
return nil
|
|
case ue.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *UeMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.owner != nil {
|
|
edges = append(edges, ue.EdgeOwner)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *UeMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case ue.EdgeOwner:
|
|
if id := m.owner; id != nil {
|
|
return []ent.Value{*id}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *UeMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *UeMutation) RemovedIDs(name string) []ent.Value {
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *UeMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 1)
|
|
if m.clearedowner {
|
|
edges = append(edges, ue.EdgeOwner)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *UeMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case ue.EdgeOwner:
|
|
return m.clearedowner
|
|
}
|
|
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 *UeMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
case ue.EdgeOwner:
|
|
m.ClearOwner()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue 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 *UeMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case ue.EdgeOwner:
|
|
m.ResetOwner()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown Ue edge %s", name)
|
|
}
|
|
|
|
// UserMutation represents an operation that mutates the User nodes in the graph.
|
|
type UserMutation struct {
|
|
config
|
|
op Op
|
|
typ string
|
|
id *int
|
|
username *string
|
|
did *string
|
|
member *bool
|
|
book *bool
|
|
manga *bool
|
|
badge *bool
|
|
bsky *bool
|
|
mastodon *bool
|
|
delete *bool
|
|
handle *bool
|
|
token *string
|
|
password *string
|
|
created_at *time.Time
|
|
updated_at *time.Time
|
|
raid_at *time.Time
|
|
server_at *time.Time
|
|
egg_at *time.Time
|
|
luck *int
|
|
addluck *int
|
|
luck_at *time.Time
|
|
like *int
|
|
addlike *int
|
|
like_rank *int
|
|
addlike_rank *int
|
|
like_at *time.Time
|
|
fav *int
|
|
addfav *int
|
|
ten *bool
|
|
ten_su *int
|
|
addten_su *int
|
|
ten_kai *int
|
|
addten_kai *int
|
|
aiten *int
|
|
addaiten *int
|
|
ten_card *string
|
|
ten_delete *string
|
|
ten_post *string
|
|
ten_get *string
|
|
ten_at *time.Time
|
|
next *string
|
|
room *int
|
|
addroom *int
|
|
model *bool
|
|
model_at *time.Time
|
|
model_attack *int
|
|
addmodel_attack *int
|
|
model_limit *int
|
|
addmodel_limit *int
|
|
model_skill *int
|
|
addmodel_skill *int
|
|
model_mode *int
|
|
addmodel_mode *int
|
|
model_critical *int
|
|
addmodel_critical *int
|
|
model_critical_d *int
|
|
addmodel_critical_d *int
|
|
game *bool
|
|
game_test *bool
|
|
game_end *bool
|
|
game_account *bool
|
|
game_lv *int
|
|
addgame_lv *int
|
|
coin *int
|
|
addcoin *int
|
|
coin_open *bool
|
|
coin_at *time.Time
|
|
clearedFields map[string]struct{}
|
|
card map[int]struct{}
|
|
removedcard map[int]struct{}
|
|
clearedcard bool
|
|
ue map[int]struct{}
|
|
removedue map[int]struct{}
|
|
clearedue bool
|
|
done bool
|
|
oldValue func(context.Context) (*User, error)
|
|
predicates []predicate.User
|
|
}
|
|
|
|
var _ ent.Mutation = (*UserMutation)(nil)
|
|
|
|
// userOption allows management of the mutation configuration using functional options.
|
|
type userOption func(*UserMutation)
|
|
|
|
// newUserMutation creates new mutation for the User entity.
|
|
func newUserMutation(c config, op Op, opts ...userOption) *UserMutation {
|
|
m := &UserMutation{
|
|
config: c,
|
|
op: op,
|
|
typ: TypeUser,
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
for _, opt := range opts {
|
|
opt(m)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// withUserID sets the ID field of the mutation.
|
|
func withUserID(id int) userOption {
|
|
return func(m *UserMutation) {
|
|
var (
|
|
err error
|
|
once sync.Once
|
|
value *User
|
|
)
|
|
m.oldValue = func(ctx context.Context) (*User, error) {
|
|
once.Do(func() {
|
|
if m.done {
|
|
err = errors.New("querying old values post mutation is not allowed")
|
|
} else {
|
|
value, err = m.Client().User.Get(ctx, id)
|
|
}
|
|
})
|
|
return value, err
|
|
}
|
|
m.id = &id
|
|
}
|
|
}
|
|
|
|
// withUser sets the old User of the mutation.
|
|
func withUser(node *User) userOption {
|
|
return func(m *UserMutation) {
|
|
m.oldValue = func(context.Context) (*User, 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 UserMutation) 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 UserMutation) 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
|
|
}
|
|
|
|
// 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 *UserMutation) ID() (id int, 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 *UserMutation) IDs(ctx context.Context) ([]int, error) {
|
|
switch {
|
|
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
|
id, exists := m.ID()
|
|
if exists {
|
|
return []int{id}, nil
|
|
}
|
|
fallthrough
|
|
case m.op.Is(OpUpdate | OpDelete):
|
|
return m.Client().User.Query().Where(m.predicates...).IDs(ctx)
|
|
default:
|
|
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
}
|
|
}
|
|
|
|
// SetUsername sets the "username" field.
|
|
func (m *UserMutation) SetUsername(s string) {
|
|
m.username = &s
|
|
}
|
|
|
|
// Username returns the value of the "username" field in the mutation.
|
|
func (m *UserMutation) Username() (r string, exists bool) {
|
|
v := m.username
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUsername returns the old "username" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldUsername(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUsername is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUsername requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUsername: %w", err)
|
|
}
|
|
return oldValue.Username, nil
|
|
}
|
|
|
|
// ResetUsername resets all changes to the "username" field.
|
|
func (m *UserMutation) ResetUsername() {
|
|
m.username = nil
|
|
}
|
|
|
|
// SetDid sets the "did" field.
|
|
func (m *UserMutation) SetDid(s string) {
|
|
m.did = &s
|
|
}
|
|
|
|
// Did returns the value of the "did" field in the mutation.
|
|
func (m *UserMutation) Did() (r string, exists bool) {
|
|
v := m.did
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDid returns the old "did" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldDid(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDid is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDid requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDid: %w", err)
|
|
}
|
|
return oldValue.Did, nil
|
|
}
|
|
|
|
// ClearDid clears the value of the "did" field.
|
|
func (m *UserMutation) ClearDid() {
|
|
m.did = nil
|
|
m.clearedFields[user.FieldDid] = struct{}{}
|
|
}
|
|
|
|
// DidCleared returns if the "did" field was cleared in this mutation.
|
|
func (m *UserMutation) DidCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldDid]
|
|
return ok
|
|
}
|
|
|
|
// ResetDid resets all changes to the "did" field.
|
|
func (m *UserMutation) ResetDid() {
|
|
m.did = nil
|
|
delete(m.clearedFields, user.FieldDid)
|
|
}
|
|
|
|
// SetMember sets the "member" field.
|
|
func (m *UserMutation) SetMember(b bool) {
|
|
m.member = &b
|
|
}
|
|
|
|
// Member returns the value of the "member" field in the mutation.
|
|
func (m *UserMutation) Member() (r bool, exists bool) {
|
|
v := m.member
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMember returns the old "member" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldMember(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldMember is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldMember requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMember: %w", err)
|
|
}
|
|
return oldValue.Member, nil
|
|
}
|
|
|
|
// ClearMember clears the value of the "member" field.
|
|
func (m *UserMutation) ClearMember() {
|
|
m.member = nil
|
|
m.clearedFields[user.FieldMember] = struct{}{}
|
|
}
|
|
|
|
// MemberCleared returns if the "member" field was cleared in this mutation.
|
|
func (m *UserMutation) MemberCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldMember]
|
|
return ok
|
|
}
|
|
|
|
// ResetMember resets all changes to the "member" field.
|
|
func (m *UserMutation) ResetMember() {
|
|
m.member = nil
|
|
delete(m.clearedFields, user.FieldMember)
|
|
}
|
|
|
|
// SetBook sets the "book" field.
|
|
func (m *UserMutation) SetBook(b bool) {
|
|
m.book = &b
|
|
}
|
|
|
|
// Book returns the value of the "book" field in the mutation.
|
|
func (m *UserMutation) Book() (r bool, exists bool) {
|
|
v := m.book
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBook returns the old "book" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldBook(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBook is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBook requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBook: %w", err)
|
|
}
|
|
return oldValue.Book, nil
|
|
}
|
|
|
|
// ClearBook clears the value of the "book" field.
|
|
func (m *UserMutation) ClearBook() {
|
|
m.book = nil
|
|
m.clearedFields[user.FieldBook] = struct{}{}
|
|
}
|
|
|
|
// BookCleared returns if the "book" field was cleared in this mutation.
|
|
func (m *UserMutation) BookCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldBook]
|
|
return ok
|
|
}
|
|
|
|
// ResetBook resets all changes to the "book" field.
|
|
func (m *UserMutation) ResetBook() {
|
|
m.book = nil
|
|
delete(m.clearedFields, user.FieldBook)
|
|
}
|
|
|
|
// SetManga sets the "manga" field.
|
|
func (m *UserMutation) SetManga(b bool) {
|
|
m.manga = &b
|
|
}
|
|
|
|
// Manga returns the value of the "manga" field in the mutation.
|
|
func (m *UserMutation) Manga() (r bool, exists bool) {
|
|
v := m.manga
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldManga returns the old "manga" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldManga(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldManga is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldManga requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldManga: %w", err)
|
|
}
|
|
return oldValue.Manga, nil
|
|
}
|
|
|
|
// ClearManga clears the value of the "manga" field.
|
|
func (m *UserMutation) ClearManga() {
|
|
m.manga = nil
|
|
m.clearedFields[user.FieldManga] = struct{}{}
|
|
}
|
|
|
|
// MangaCleared returns if the "manga" field was cleared in this mutation.
|
|
func (m *UserMutation) MangaCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldManga]
|
|
return ok
|
|
}
|
|
|
|
// ResetManga resets all changes to the "manga" field.
|
|
func (m *UserMutation) ResetManga() {
|
|
m.manga = nil
|
|
delete(m.clearedFields, user.FieldManga)
|
|
}
|
|
|
|
// SetBadge sets the "badge" field.
|
|
func (m *UserMutation) SetBadge(b bool) {
|
|
m.badge = &b
|
|
}
|
|
|
|
// Badge returns the value of the "badge" field in the mutation.
|
|
func (m *UserMutation) Badge() (r bool, exists bool) {
|
|
v := m.badge
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBadge returns the old "badge" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldBadge(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBadge is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBadge requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBadge: %w", err)
|
|
}
|
|
return oldValue.Badge, nil
|
|
}
|
|
|
|
// ClearBadge clears the value of the "badge" field.
|
|
func (m *UserMutation) ClearBadge() {
|
|
m.badge = nil
|
|
m.clearedFields[user.FieldBadge] = struct{}{}
|
|
}
|
|
|
|
// BadgeCleared returns if the "badge" field was cleared in this mutation.
|
|
func (m *UserMutation) BadgeCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldBadge]
|
|
return ok
|
|
}
|
|
|
|
// ResetBadge resets all changes to the "badge" field.
|
|
func (m *UserMutation) ResetBadge() {
|
|
m.badge = nil
|
|
delete(m.clearedFields, user.FieldBadge)
|
|
}
|
|
|
|
// SetBsky sets the "bsky" field.
|
|
func (m *UserMutation) SetBsky(b bool) {
|
|
m.bsky = &b
|
|
}
|
|
|
|
// Bsky returns the value of the "bsky" field in the mutation.
|
|
func (m *UserMutation) Bsky() (r bool, exists bool) {
|
|
v := m.bsky
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldBsky returns the old "bsky" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldBsky(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldBsky is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldBsky requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldBsky: %w", err)
|
|
}
|
|
return oldValue.Bsky, nil
|
|
}
|
|
|
|
// ClearBsky clears the value of the "bsky" field.
|
|
func (m *UserMutation) ClearBsky() {
|
|
m.bsky = nil
|
|
m.clearedFields[user.FieldBsky] = struct{}{}
|
|
}
|
|
|
|
// BskyCleared returns if the "bsky" field was cleared in this mutation.
|
|
func (m *UserMutation) BskyCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldBsky]
|
|
return ok
|
|
}
|
|
|
|
// ResetBsky resets all changes to the "bsky" field.
|
|
func (m *UserMutation) ResetBsky() {
|
|
m.bsky = nil
|
|
delete(m.clearedFields, user.FieldBsky)
|
|
}
|
|
|
|
// SetMastodon sets the "mastodon" field.
|
|
func (m *UserMutation) SetMastodon(b bool) {
|
|
m.mastodon = &b
|
|
}
|
|
|
|
// Mastodon returns the value of the "mastodon" field in the mutation.
|
|
func (m *UserMutation) Mastodon() (r bool, exists bool) {
|
|
v := m.mastodon
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldMastodon returns the old "mastodon" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldMastodon(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldMastodon is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldMastodon requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldMastodon: %w", err)
|
|
}
|
|
return oldValue.Mastodon, nil
|
|
}
|
|
|
|
// ClearMastodon clears the value of the "mastodon" field.
|
|
func (m *UserMutation) ClearMastodon() {
|
|
m.mastodon = nil
|
|
m.clearedFields[user.FieldMastodon] = struct{}{}
|
|
}
|
|
|
|
// MastodonCleared returns if the "mastodon" field was cleared in this mutation.
|
|
func (m *UserMutation) MastodonCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldMastodon]
|
|
return ok
|
|
}
|
|
|
|
// ResetMastodon resets all changes to the "mastodon" field.
|
|
func (m *UserMutation) ResetMastodon() {
|
|
m.mastodon = nil
|
|
delete(m.clearedFields, user.FieldMastodon)
|
|
}
|
|
|
|
// SetDelete sets the "delete" field.
|
|
func (m *UserMutation) SetDelete(b bool) {
|
|
m.delete = &b
|
|
}
|
|
|
|
// Delete returns the value of the "delete" field in the mutation.
|
|
func (m *UserMutation) Delete() (r bool, exists bool) {
|
|
v := m.delete
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldDelete returns the old "delete" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldDelete(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldDelete is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldDelete requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldDelete: %w", err)
|
|
}
|
|
return oldValue.Delete, nil
|
|
}
|
|
|
|
// ClearDelete clears the value of the "delete" field.
|
|
func (m *UserMutation) ClearDelete() {
|
|
m.delete = nil
|
|
m.clearedFields[user.FieldDelete] = struct{}{}
|
|
}
|
|
|
|
// DeleteCleared returns if the "delete" field was cleared in this mutation.
|
|
func (m *UserMutation) DeleteCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldDelete]
|
|
return ok
|
|
}
|
|
|
|
// ResetDelete resets all changes to the "delete" field.
|
|
func (m *UserMutation) ResetDelete() {
|
|
m.delete = nil
|
|
delete(m.clearedFields, user.FieldDelete)
|
|
}
|
|
|
|
// SetHandle sets the "handle" field.
|
|
func (m *UserMutation) SetHandle(b bool) {
|
|
m.handle = &b
|
|
}
|
|
|
|
// Handle returns the value of the "handle" field in the mutation.
|
|
func (m *UserMutation) Handle() (r bool, exists bool) {
|
|
v := m.handle
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldHandle returns the old "handle" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldHandle(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldHandle is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldHandle requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldHandle: %w", err)
|
|
}
|
|
return oldValue.Handle, nil
|
|
}
|
|
|
|
// ClearHandle clears the value of the "handle" field.
|
|
func (m *UserMutation) ClearHandle() {
|
|
m.handle = nil
|
|
m.clearedFields[user.FieldHandle] = struct{}{}
|
|
}
|
|
|
|
// HandleCleared returns if the "handle" field was cleared in this mutation.
|
|
func (m *UserMutation) HandleCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldHandle]
|
|
return ok
|
|
}
|
|
|
|
// ResetHandle resets all changes to the "handle" field.
|
|
func (m *UserMutation) ResetHandle() {
|
|
m.handle = nil
|
|
delete(m.clearedFields, user.FieldHandle)
|
|
}
|
|
|
|
// SetToken sets the "token" field.
|
|
func (m *UserMutation) SetToken(s string) {
|
|
m.token = &s
|
|
}
|
|
|
|
// Token returns the value of the "token" field in the mutation.
|
|
func (m *UserMutation) Token() (r string, exists bool) {
|
|
v := m.token
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldToken returns the old "token" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldToken(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldToken is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldToken requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldToken: %w", err)
|
|
}
|
|
return oldValue.Token, nil
|
|
}
|
|
|
|
// ClearToken clears the value of the "token" field.
|
|
func (m *UserMutation) ClearToken() {
|
|
m.token = nil
|
|
m.clearedFields[user.FieldToken] = struct{}{}
|
|
}
|
|
|
|
// TokenCleared returns if the "token" field was cleared in this mutation.
|
|
func (m *UserMutation) TokenCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldToken]
|
|
return ok
|
|
}
|
|
|
|
// ResetToken resets all changes to the "token" field.
|
|
func (m *UserMutation) ResetToken() {
|
|
m.token = nil
|
|
delete(m.clearedFields, user.FieldToken)
|
|
}
|
|
|
|
// SetPassword sets the "password" field.
|
|
func (m *UserMutation) SetPassword(s string) {
|
|
m.password = &s
|
|
}
|
|
|
|
// Password returns the value of the "password" field in the mutation.
|
|
func (m *UserMutation) Password() (r string, exists bool) {
|
|
v := m.password
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldPassword returns the old "password" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldPassword(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldPassword is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldPassword requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldPassword: %w", err)
|
|
}
|
|
return oldValue.Password, nil
|
|
}
|
|
|
|
// ResetPassword resets all changes to the "password" field.
|
|
func (m *UserMutation) ResetPassword() {
|
|
m.password = nil
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (m *UserMutation) SetCreatedAt(t time.Time) {
|
|
m.created_at = &t
|
|
}
|
|
|
|
// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
func (m *UserMutation) CreatedAt() (r time.Time, exists bool) {
|
|
v := m.created_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCreatedAt returns the old "created_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
}
|
|
return oldValue.CreatedAt, nil
|
|
}
|
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
func (m *UserMutation) ClearCreatedAt() {
|
|
m.created_at = nil
|
|
m.clearedFields[user.FieldCreatedAt] = struct{}{}
|
|
}
|
|
|
|
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
|
func (m *UserMutation) CreatedAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldCreatedAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetCreatedAt resets all changes to the "created_at" field.
|
|
func (m *UserMutation) ResetCreatedAt() {
|
|
m.created_at = nil
|
|
delete(m.clearedFields, user.FieldCreatedAt)
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (m *UserMutation) SetUpdatedAt(t time.Time) {
|
|
m.updated_at = &t
|
|
}
|
|
|
|
// UpdatedAt returns the value of the "updated_at" field in the mutation.
|
|
func (m *UserMutation) UpdatedAt() (r time.Time, exists bool) {
|
|
v := m.updated_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldUpdatedAt returns the old "updated_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
|
|
}
|
|
return oldValue.UpdatedAt, nil
|
|
}
|
|
|
|
// ClearUpdatedAt clears the value of the "updated_at" field.
|
|
func (m *UserMutation) ClearUpdatedAt() {
|
|
m.updated_at = nil
|
|
m.clearedFields[user.FieldUpdatedAt] = struct{}{}
|
|
}
|
|
|
|
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
|
func (m *UserMutation) UpdatedAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldUpdatedAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
|
func (m *UserMutation) ResetUpdatedAt() {
|
|
m.updated_at = nil
|
|
delete(m.clearedFields, user.FieldUpdatedAt)
|
|
}
|
|
|
|
// SetRaidAt sets the "raid_at" field.
|
|
func (m *UserMutation) SetRaidAt(t time.Time) {
|
|
m.raid_at = &t
|
|
}
|
|
|
|
// RaidAt returns the value of the "raid_at" field in the mutation.
|
|
func (m *UserMutation) RaidAt() (r time.Time, exists bool) {
|
|
v := m.raid_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRaidAt returns the old "raid_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldRaidAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldRaidAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldRaidAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRaidAt: %w", err)
|
|
}
|
|
return oldValue.RaidAt, nil
|
|
}
|
|
|
|
// ClearRaidAt clears the value of the "raid_at" field.
|
|
func (m *UserMutation) ClearRaidAt() {
|
|
m.raid_at = nil
|
|
m.clearedFields[user.FieldRaidAt] = struct{}{}
|
|
}
|
|
|
|
// RaidAtCleared returns if the "raid_at" field was cleared in this mutation.
|
|
func (m *UserMutation) RaidAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldRaidAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetRaidAt resets all changes to the "raid_at" field.
|
|
func (m *UserMutation) ResetRaidAt() {
|
|
m.raid_at = nil
|
|
delete(m.clearedFields, user.FieldRaidAt)
|
|
}
|
|
|
|
// SetServerAt sets the "server_at" field.
|
|
func (m *UserMutation) SetServerAt(t time.Time) {
|
|
m.server_at = &t
|
|
}
|
|
|
|
// ServerAt returns the value of the "server_at" field in the mutation.
|
|
func (m *UserMutation) ServerAt() (r time.Time, exists bool) {
|
|
v := m.server_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldServerAt returns the old "server_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldServerAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldServerAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldServerAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldServerAt: %w", err)
|
|
}
|
|
return oldValue.ServerAt, nil
|
|
}
|
|
|
|
// ClearServerAt clears the value of the "server_at" field.
|
|
func (m *UserMutation) ClearServerAt() {
|
|
m.server_at = nil
|
|
m.clearedFields[user.FieldServerAt] = struct{}{}
|
|
}
|
|
|
|
// ServerAtCleared returns if the "server_at" field was cleared in this mutation.
|
|
func (m *UserMutation) ServerAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldServerAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetServerAt resets all changes to the "server_at" field.
|
|
func (m *UserMutation) ResetServerAt() {
|
|
m.server_at = nil
|
|
delete(m.clearedFields, user.FieldServerAt)
|
|
}
|
|
|
|
// SetEggAt sets the "egg_at" field.
|
|
func (m *UserMutation) SetEggAt(t time.Time) {
|
|
m.egg_at = &t
|
|
}
|
|
|
|
// EggAt returns the value of the "egg_at" field in the mutation.
|
|
func (m *UserMutation) EggAt() (r time.Time, exists bool) {
|
|
v := m.egg_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldEggAt returns the old "egg_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldEggAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldEggAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldEggAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldEggAt: %w", err)
|
|
}
|
|
return oldValue.EggAt, nil
|
|
}
|
|
|
|
// ClearEggAt clears the value of the "egg_at" field.
|
|
func (m *UserMutation) ClearEggAt() {
|
|
m.egg_at = nil
|
|
m.clearedFields[user.FieldEggAt] = struct{}{}
|
|
}
|
|
|
|
// EggAtCleared returns if the "egg_at" field was cleared in this mutation.
|
|
func (m *UserMutation) EggAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldEggAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetEggAt resets all changes to the "egg_at" field.
|
|
func (m *UserMutation) ResetEggAt() {
|
|
m.egg_at = nil
|
|
delete(m.clearedFields, user.FieldEggAt)
|
|
}
|
|
|
|
// SetLuck sets the "luck" field.
|
|
func (m *UserMutation) SetLuck(i int) {
|
|
m.luck = &i
|
|
m.addluck = nil
|
|
}
|
|
|
|
// Luck returns the value of the "luck" field in the mutation.
|
|
func (m *UserMutation) Luck() (r int, exists bool) {
|
|
v := m.luck
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLuck returns the old "luck" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldLuck(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLuck is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLuck requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLuck: %w", err)
|
|
}
|
|
return oldValue.Luck, nil
|
|
}
|
|
|
|
// AddLuck adds i to the "luck" field.
|
|
func (m *UserMutation) AddLuck(i int) {
|
|
if m.addluck != nil {
|
|
*m.addluck += i
|
|
} else {
|
|
m.addluck = &i
|
|
}
|
|
}
|
|
|
|
// AddedLuck returns the value that was added to the "luck" field in this mutation.
|
|
func (m *UserMutation) AddedLuck() (r int, exists bool) {
|
|
v := m.addluck
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLuck clears the value of the "luck" field.
|
|
func (m *UserMutation) ClearLuck() {
|
|
m.luck = nil
|
|
m.addluck = nil
|
|
m.clearedFields[user.FieldLuck] = struct{}{}
|
|
}
|
|
|
|
// LuckCleared returns if the "luck" field was cleared in this mutation.
|
|
func (m *UserMutation) LuckCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldLuck]
|
|
return ok
|
|
}
|
|
|
|
// ResetLuck resets all changes to the "luck" field.
|
|
func (m *UserMutation) ResetLuck() {
|
|
m.luck = nil
|
|
m.addluck = nil
|
|
delete(m.clearedFields, user.FieldLuck)
|
|
}
|
|
|
|
// SetLuckAt sets the "luck_at" field.
|
|
func (m *UserMutation) SetLuckAt(t time.Time) {
|
|
m.luck_at = &t
|
|
}
|
|
|
|
// LuckAt returns the value of the "luck_at" field in the mutation.
|
|
func (m *UserMutation) LuckAt() (r time.Time, exists bool) {
|
|
v := m.luck_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLuckAt returns the old "luck_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldLuckAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLuckAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLuckAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLuckAt: %w", err)
|
|
}
|
|
return oldValue.LuckAt, nil
|
|
}
|
|
|
|
// ClearLuckAt clears the value of the "luck_at" field.
|
|
func (m *UserMutation) ClearLuckAt() {
|
|
m.luck_at = nil
|
|
m.clearedFields[user.FieldLuckAt] = struct{}{}
|
|
}
|
|
|
|
// LuckAtCleared returns if the "luck_at" field was cleared in this mutation.
|
|
func (m *UserMutation) LuckAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldLuckAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetLuckAt resets all changes to the "luck_at" field.
|
|
func (m *UserMutation) ResetLuckAt() {
|
|
m.luck_at = nil
|
|
delete(m.clearedFields, user.FieldLuckAt)
|
|
}
|
|
|
|
// SetLike sets the "like" field.
|
|
func (m *UserMutation) SetLike(i int) {
|
|
m.like = &i
|
|
m.addlike = nil
|
|
}
|
|
|
|
// Like returns the value of the "like" field in the mutation.
|
|
func (m *UserMutation) Like() (r int, exists bool) {
|
|
v := m.like
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLike returns the old "like" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldLike(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLike is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLike requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLike: %w", err)
|
|
}
|
|
return oldValue.Like, nil
|
|
}
|
|
|
|
// AddLike adds i to the "like" field.
|
|
func (m *UserMutation) AddLike(i int) {
|
|
if m.addlike != nil {
|
|
*m.addlike += i
|
|
} else {
|
|
m.addlike = &i
|
|
}
|
|
}
|
|
|
|
// AddedLike returns the value that was added to the "like" field in this mutation.
|
|
func (m *UserMutation) AddedLike() (r int, exists bool) {
|
|
v := m.addlike
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLike clears the value of the "like" field.
|
|
func (m *UserMutation) ClearLike() {
|
|
m.like = nil
|
|
m.addlike = nil
|
|
m.clearedFields[user.FieldLike] = struct{}{}
|
|
}
|
|
|
|
// LikeCleared returns if the "like" field was cleared in this mutation.
|
|
func (m *UserMutation) LikeCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldLike]
|
|
return ok
|
|
}
|
|
|
|
// ResetLike resets all changes to the "like" field.
|
|
func (m *UserMutation) ResetLike() {
|
|
m.like = nil
|
|
m.addlike = nil
|
|
delete(m.clearedFields, user.FieldLike)
|
|
}
|
|
|
|
// SetLikeRank sets the "like_rank" field.
|
|
func (m *UserMutation) SetLikeRank(i int) {
|
|
m.like_rank = &i
|
|
m.addlike_rank = nil
|
|
}
|
|
|
|
// LikeRank returns the value of the "like_rank" field in the mutation.
|
|
func (m *UserMutation) LikeRank() (r int, exists bool) {
|
|
v := m.like_rank
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLikeRank returns the old "like_rank" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldLikeRank(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLikeRank is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLikeRank requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLikeRank: %w", err)
|
|
}
|
|
return oldValue.LikeRank, nil
|
|
}
|
|
|
|
// AddLikeRank adds i to the "like_rank" field.
|
|
func (m *UserMutation) AddLikeRank(i int) {
|
|
if m.addlike_rank != nil {
|
|
*m.addlike_rank += i
|
|
} else {
|
|
m.addlike_rank = &i
|
|
}
|
|
}
|
|
|
|
// AddedLikeRank returns the value that was added to the "like_rank" field in this mutation.
|
|
func (m *UserMutation) AddedLikeRank() (r int, exists bool) {
|
|
v := m.addlike_rank
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearLikeRank clears the value of the "like_rank" field.
|
|
func (m *UserMutation) ClearLikeRank() {
|
|
m.like_rank = nil
|
|
m.addlike_rank = nil
|
|
m.clearedFields[user.FieldLikeRank] = struct{}{}
|
|
}
|
|
|
|
// LikeRankCleared returns if the "like_rank" field was cleared in this mutation.
|
|
func (m *UserMutation) LikeRankCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldLikeRank]
|
|
return ok
|
|
}
|
|
|
|
// ResetLikeRank resets all changes to the "like_rank" field.
|
|
func (m *UserMutation) ResetLikeRank() {
|
|
m.like_rank = nil
|
|
m.addlike_rank = nil
|
|
delete(m.clearedFields, user.FieldLikeRank)
|
|
}
|
|
|
|
// SetLikeAt sets the "like_at" field.
|
|
func (m *UserMutation) SetLikeAt(t time.Time) {
|
|
m.like_at = &t
|
|
}
|
|
|
|
// LikeAt returns the value of the "like_at" field in the mutation.
|
|
func (m *UserMutation) LikeAt() (r time.Time, exists bool) {
|
|
v := m.like_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldLikeAt returns the old "like_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldLikeAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldLikeAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldLikeAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldLikeAt: %w", err)
|
|
}
|
|
return oldValue.LikeAt, nil
|
|
}
|
|
|
|
// ClearLikeAt clears the value of the "like_at" field.
|
|
func (m *UserMutation) ClearLikeAt() {
|
|
m.like_at = nil
|
|
m.clearedFields[user.FieldLikeAt] = struct{}{}
|
|
}
|
|
|
|
// LikeAtCleared returns if the "like_at" field was cleared in this mutation.
|
|
func (m *UserMutation) LikeAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldLikeAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetLikeAt resets all changes to the "like_at" field.
|
|
func (m *UserMutation) ResetLikeAt() {
|
|
m.like_at = nil
|
|
delete(m.clearedFields, user.FieldLikeAt)
|
|
}
|
|
|
|
// SetFav sets the "fav" field.
|
|
func (m *UserMutation) SetFav(i int) {
|
|
m.fav = &i
|
|
m.addfav = nil
|
|
}
|
|
|
|
// Fav returns the value of the "fav" field in the mutation.
|
|
func (m *UserMutation) Fav() (r int, exists bool) {
|
|
v := m.fav
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldFav returns the old "fav" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldFav(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldFav is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldFav requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldFav: %w", err)
|
|
}
|
|
return oldValue.Fav, nil
|
|
}
|
|
|
|
// AddFav adds i to the "fav" field.
|
|
func (m *UserMutation) AddFav(i int) {
|
|
if m.addfav != nil {
|
|
*m.addfav += i
|
|
} else {
|
|
m.addfav = &i
|
|
}
|
|
}
|
|
|
|
// AddedFav returns the value that was added to the "fav" field in this mutation.
|
|
func (m *UserMutation) AddedFav() (r int, exists bool) {
|
|
v := m.addfav
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearFav clears the value of the "fav" field.
|
|
func (m *UserMutation) ClearFav() {
|
|
m.fav = nil
|
|
m.addfav = nil
|
|
m.clearedFields[user.FieldFav] = struct{}{}
|
|
}
|
|
|
|
// FavCleared returns if the "fav" field was cleared in this mutation.
|
|
func (m *UserMutation) FavCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldFav]
|
|
return ok
|
|
}
|
|
|
|
// ResetFav resets all changes to the "fav" field.
|
|
func (m *UserMutation) ResetFav() {
|
|
m.fav = nil
|
|
m.addfav = nil
|
|
delete(m.clearedFields, user.FieldFav)
|
|
}
|
|
|
|
// SetTen sets the "ten" field.
|
|
func (m *UserMutation) SetTen(b bool) {
|
|
m.ten = &b
|
|
}
|
|
|
|
// Ten returns the value of the "ten" field in the mutation.
|
|
func (m *UserMutation) Ten() (r bool, exists bool) {
|
|
v := m.ten
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTen returns the old "ten" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTen(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTen is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTen requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTen: %w", err)
|
|
}
|
|
return oldValue.Ten, nil
|
|
}
|
|
|
|
// ClearTen clears the value of the "ten" field.
|
|
func (m *UserMutation) ClearTen() {
|
|
m.ten = nil
|
|
m.clearedFields[user.FieldTen] = struct{}{}
|
|
}
|
|
|
|
// TenCleared returns if the "ten" field was cleared in this mutation.
|
|
func (m *UserMutation) TenCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTen]
|
|
return ok
|
|
}
|
|
|
|
// ResetTen resets all changes to the "ten" field.
|
|
func (m *UserMutation) ResetTen() {
|
|
m.ten = nil
|
|
delete(m.clearedFields, user.FieldTen)
|
|
}
|
|
|
|
// SetTenSu sets the "ten_su" field.
|
|
func (m *UserMutation) SetTenSu(i int) {
|
|
m.ten_su = &i
|
|
m.addten_su = nil
|
|
}
|
|
|
|
// TenSu returns the value of the "ten_su" field in the mutation.
|
|
func (m *UserMutation) TenSu() (r int, exists bool) {
|
|
v := m.ten_su
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenSu returns the old "ten_su" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenSu(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenSu is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenSu requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenSu: %w", err)
|
|
}
|
|
return oldValue.TenSu, nil
|
|
}
|
|
|
|
// AddTenSu adds i to the "ten_su" field.
|
|
func (m *UserMutation) AddTenSu(i int) {
|
|
if m.addten_su != nil {
|
|
*m.addten_su += i
|
|
} else {
|
|
m.addten_su = &i
|
|
}
|
|
}
|
|
|
|
// AddedTenSu returns the value that was added to the "ten_su" field in this mutation.
|
|
func (m *UserMutation) AddedTenSu() (r int, exists bool) {
|
|
v := m.addten_su
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearTenSu clears the value of the "ten_su" field.
|
|
func (m *UserMutation) ClearTenSu() {
|
|
m.ten_su = nil
|
|
m.addten_su = nil
|
|
m.clearedFields[user.FieldTenSu] = struct{}{}
|
|
}
|
|
|
|
// TenSuCleared returns if the "ten_su" field was cleared in this mutation.
|
|
func (m *UserMutation) TenSuCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenSu]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenSu resets all changes to the "ten_su" field.
|
|
func (m *UserMutation) ResetTenSu() {
|
|
m.ten_su = nil
|
|
m.addten_su = nil
|
|
delete(m.clearedFields, user.FieldTenSu)
|
|
}
|
|
|
|
// SetTenKai sets the "ten_kai" field.
|
|
func (m *UserMutation) SetTenKai(i int) {
|
|
m.ten_kai = &i
|
|
m.addten_kai = nil
|
|
}
|
|
|
|
// TenKai returns the value of the "ten_kai" field in the mutation.
|
|
func (m *UserMutation) TenKai() (r int, exists bool) {
|
|
v := m.ten_kai
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenKai returns the old "ten_kai" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenKai(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenKai is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenKai requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenKai: %w", err)
|
|
}
|
|
return oldValue.TenKai, nil
|
|
}
|
|
|
|
// AddTenKai adds i to the "ten_kai" field.
|
|
func (m *UserMutation) AddTenKai(i int) {
|
|
if m.addten_kai != nil {
|
|
*m.addten_kai += i
|
|
} else {
|
|
m.addten_kai = &i
|
|
}
|
|
}
|
|
|
|
// AddedTenKai returns the value that was added to the "ten_kai" field in this mutation.
|
|
func (m *UserMutation) AddedTenKai() (r int, exists bool) {
|
|
v := m.addten_kai
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearTenKai clears the value of the "ten_kai" field.
|
|
func (m *UserMutation) ClearTenKai() {
|
|
m.ten_kai = nil
|
|
m.addten_kai = nil
|
|
m.clearedFields[user.FieldTenKai] = struct{}{}
|
|
}
|
|
|
|
// TenKaiCleared returns if the "ten_kai" field was cleared in this mutation.
|
|
func (m *UserMutation) TenKaiCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenKai]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenKai resets all changes to the "ten_kai" field.
|
|
func (m *UserMutation) ResetTenKai() {
|
|
m.ten_kai = nil
|
|
m.addten_kai = nil
|
|
delete(m.clearedFields, user.FieldTenKai)
|
|
}
|
|
|
|
// SetAiten sets the "aiten" field.
|
|
func (m *UserMutation) SetAiten(i int) {
|
|
m.aiten = &i
|
|
m.addaiten = nil
|
|
}
|
|
|
|
// Aiten returns the value of the "aiten" field in the mutation.
|
|
func (m *UserMutation) Aiten() (r int, exists bool) {
|
|
v := m.aiten
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldAiten returns the old "aiten" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldAiten(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldAiten is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldAiten requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldAiten: %w", err)
|
|
}
|
|
return oldValue.Aiten, nil
|
|
}
|
|
|
|
// AddAiten adds i to the "aiten" field.
|
|
func (m *UserMutation) AddAiten(i int) {
|
|
if m.addaiten != nil {
|
|
*m.addaiten += i
|
|
} else {
|
|
m.addaiten = &i
|
|
}
|
|
}
|
|
|
|
// AddedAiten returns the value that was added to the "aiten" field in this mutation.
|
|
func (m *UserMutation) AddedAiten() (r int, exists bool) {
|
|
v := m.addaiten
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearAiten clears the value of the "aiten" field.
|
|
func (m *UserMutation) ClearAiten() {
|
|
m.aiten = nil
|
|
m.addaiten = nil
|
|
m.clearedFields[user.FieldAiten] = struct{}{}
|
|
}
|
|
|
|
// AitenCleared returns if the "aiten" field was cleared in this mutation.
|
|
func (m *UserMutation) AitenCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldAiten]
|
|
return ok
|
|
}
|
|
|
|
// ResetAiten resets all changes to the "aiten" field.
|
|
func (m *UserMutation) ResetAiten() {
|
|
m.aiten = nil
|
|
m.addaiten = nil
|
|
delete(m.clearedFields, user.FieldAiten)
|
|
}
|
|
|
|
// SetTenCard sets the "ten_card" field.
|
|
func (m *UserMutation) SetTenCard(s string) {
|
|
m.ten_card = &s
|
|
}
|
|
|
|
// TenCard returns the value of the "ten_card" field in the mutation.
|
|
func (m *UserMutation) TenCard() (r string, exists bool) {
|
|
v := m.ten_card
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenCard returns the old "ten_card" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenCard(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenCard is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenCard requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenCard: %w", err)
|
|
}
|
|
return oldValue.TenCard, nil
|
|
}
|
|
|
|
// ClearTenCard clears the value of the "ten_card" field.
|
|
func (m *UserMutation) ClearTenCard() {
|
|
m.ten_card = nil
|
|
m.clearedFields[user.FieldTenCard] = struct{}{}
|
|
}
|
|
|
|
// TenCardCleared returns if the "ten_card" field was cleared in this mutation.
|
|
func (m *UserMutation) TenCardCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenCard]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenCard resets all changes to the "ten_card" field.
|
|
func (m *UserMutation) ResetTenCard() {
|
|
m.ten_card = nil
|
|
delete(m.clearedFields, user.FieldTenCard)
|
|
}
|
|
|
|
// SetTenDelete sets the "ten_delete" field.
|
|
func (m *UserMutation) SetTenDelete(s string) {
|
|
m.ten_delete = &s
|
|
}
|
|
|
|
// TenDelete returns the value of the "ten_delete" field in the mutation.
|
|
func (m *UserMutation) TenDelete() (r string, exists bool) {
|
|
v := m.ten_delete
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenDelete returns the old "ten_delete" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenDelete(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenDelete is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenDelete requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenDelete: %w", err)
|
|
}
|
|
return oldValue.TenDelete, nil
|
|
}
|
|
|
|
// ClearTenDelete clears the value of the "ten_delete" field.
|
|
func (m *UserMutation) ClearTenDelete() {
|
|
m.ten_delete = nil
|
|
m.clearedFields[user.FieldTenDelete] = struct{}{}
|
|
}
|
|
|
|
// TenDeleteCleared returns if the "ten_delete" field was cleared in this mutation.
|
|
func (m *UserMutation) TenDeleteCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenDelete]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenDelete resets all changes to the "ten_delete" field.
|
|
func (m *UserMutation) ResetTenDelete() {
|
|
m.ten_delete = nil
|
|
delete(m.clearedFields, user.FieldTenDelete)
|
|
}
|
|
|
|
// SetTenPost sets the "ten_post" field.
|
|
func (m *UserMutation) SetTenPost(s string) {
|
|
m.ten_post = &s
|
|
}
|
|
|
|
// TenPost returns the value of the "ten_post" field in the mutation.
|
|
func (m *UserMutation) TenPost() (r string, exists bool) {
|
|
v := m.ten_post
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenPost returns the old "ten_post" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenPost(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenPost is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenPost requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenPost: %w", err)
|
|
}
|
|
return oldValue.TenPost, nil
|
|
}
|
|
|
|
// ClearTenPost clears the value of the "ten_post" field.
|
|
func (m *UserMutation) ClearTenPost() {
|
|
m.ten_post = nil
|
|
m.clearedFields[user.FieldTenPost] = struct{}{}
|
|
}
|
|
|
|
// TenPostCleared returns if the "ten_post" field was cleared in this mutation.
|
|
func (m *UserMutation) TenPostCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenPost]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenPost resets all changes to the "ten_post" field.
|
|
func (m *UserMutation) ResetTenPost() {
|
|
m.ten_post = nil
|
|
delete(m.clearedFields, user.FieldTenPost)
|
|
}
|
|
|
|
// SetTenGet sets the "ten_get" field.
|
|
func (m *UserMutation) SetTenGet(s string) {
|
|
m.ten_get = &s
|
|
}
|
|
|
|
// TenGet returns the value of the "ten_get" field in the mutation.
|
|
func (m *UserMutation) TenGet() (r string, exists bool) {
|
|
v := m.ten_get
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenGet returns the old "ten_get" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenGet(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenGet is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenGet requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenGet: %w", err)
|
|
}
|
|
return oldValue.TenGet, nil
|
|
}
|
|
|
|
// ClearTenGet clears the value of the "ten_get" field.
|
|
func (m *UserMutation) ClearTenGet() {
|
|
m.ten_get = nil
|
|
m.clearedFields[user.FieldTenGet] = struct{}{}
|
|
}
|
|
|
|
// TenGetCleared returns if the "ten_get" field was cleared in this mutation.
|
|
func (m *UserMutation) TenGetCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenGet]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenGet resets all changes to the "ten_get" field.
|
|
func (m *UserMutation) ResetTenGet() {
|
|
m.ten_get = nil
|
|
delete(m.clearedFields, user.FieldTenGet)
|
|
}
|
|
|
|
// SetTenAt sets the "ten_at" field.
|
|
func (m *UserMutation) SetTenAt(t time.Time) {
|
|
m.ten_at = &t
|
|
}
|
|
|
|
// TenAt returns the value of the "ten_at" field in the mutation.
|
|
func (m *UserMutation) TenAt() (r time.Time, exists bool) {
|
|
v := m.ten_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldTenAt returns the old "ten_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldTenAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldTenAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldTenAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldTenAt: %w", err)
|
|
}
|
|
return oldValue.TenAt, nil
|
|
}
|
|
|
|
// ClearTenAt clears the value of the "ten_at" field.
|
|
func (m *UserMutation) ClearTenAt() {
|
|
m.ten_at = nil
|
|
m.clearedFields[user.FieldTenAt] = struct{}{}
|
|
}
|
|
|
|
// TenAtCleared returns if the "ten_at" field was cleared in this mutation.
|
|
func (m *UserMutation) TenAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldTenAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetTenAt resets all changes to the "ten_at" field.
|
|
func (m *UserMutation) ResetTenAt() {
|
|
m.ten_at = nil
|
|
delete(m.clearedFields, user.FieldTenAt)
|
|
}
|
|
|
|
// SetNext sets the "next" field.
|
|
func (m *UserMutation) SetNext(s string) {
|
|
m.next = &s
|
|
}
|
|
|
|
// Next returns the value of the "next" field in the mutation.
|
|
func (m *UserMutation) Next() (r string, exists bool) {
|
|
v := m.next
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldNext returns the old "next" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldNext(ctx context.Context) (v string, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldNext is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldNext requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldNext: %w", err)
|
|
}
|
|
return oldValue.Next, nil
|
|
}
|
|
|
|
// ClearNext clears the value of the "next" field.
|
|
func (m *UserMutation) ClearNext() {
|
|
m.next = nil
|
|
m.clearedFields[user.FieldNext] = struct{}{}
|
|
}
|
|
|
|
// NextCleared returns if the "next" field was cleared in this mutation.
|
|
func (m *UserMutation) NextCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldNext]
|
|
return ok
|
|
}
|
|
|
|
// ResetNext resets all changes to the "next" field.
|
|
func (m *UserMutation) ResetNext() {
|
|
m.next = nil
|
|
delete(m.clearedFields, user.FieldNext)
|
|
}
|
|
|
|
// SetRoom sets the "room" field.
|
|
func (m *UserMutation) SetRoom(i int) {
|
|
m.room = &i
|
|
m.addroom = nil
|
|
}
|
|
|
|
// Room returns the value of the "room" field in the mutation.
|
|
func (m *UserMutation) Room() (r int, exists bool) {
|
|
v := m.room
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldRoom returns the old "room" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldRoom(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldRoom is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldRoom requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldRoom: %w", err)
|
|
}
|
|
return oldValue.Room, nil
|
|
}
|
|
|
|
// AddRoom adds i to the "room" field.
|
|
func (m *UserMutation) AddRoom(i int) {
|
|
if m.addroom != nil {
|
|
*m.addroom += i
|
|
} else {
|
|
m.addroom = &i
|
|
}
|
|
}
|
|
|
|
// AddedRoom returns the value that was added to the "room" field in this mutation.
|
|
func (m *UserMutation) AddedRoom() (r int, exists bool) {
|
|
v := m.addroom
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearRoom clears the value of the "room" field.
|
|
func (m *UserMutation) ClearRoom() {
|
|
m.room = nil
|
|
m.addroom = nil
|
|
m.clearedFields[user.FieldRoom] = struct{}{}
|
|
}
|
|
|
|
// RoomCleared returns if the "room" field was cleared in this mutation.
|
|
func (m *UserMutation) RoomCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldRoom]
|
|
return ok
|
|
}
|
|
|
|
// ResetRoom resets all changes to the "room" field.
|
|
func (m *UserMutation) ResetRoom() {
|
|
m.room = nil
|
|
m.addroom = nil
|
|
delete(m.clearedFields, user.FieldRoom)
|
|
}
|
|
|
|
// SetModel sets the "model" field.
|
|
func (m *UserMutation) SetModel(b bool) {
|
|
m.model = &b
|
|
}
|
|
|
|
// Model returns the value of the "model" field in the mutation.
|
|
func (m *UserMutation) Model() (r bool, exists bool) {
|
|
v := m.model
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModel returns the old "model" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModel(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModel is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModel requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModel: %w", err)
|
|
}
|
|
return oldValue.Model, nil
|
|
}
|
|
|
|
// ClearModel clears the value of the "model" field.
|
|
func (m *UserMutation) ClearModel() {
|
|
m.model = nil
|
|
m.clearedFields[user.FieldModel] = struct{}{}
|
|
}
|
|
|
|
// ModelCleared returns if the "model" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModel]
|
|
return ok
|
|
}
|
|
|
|
// ResetModel resets all changes to the "model" field.
|
|
func (m *UserMutation) ResetModel() {
|
|
m.model = nil
|
|
delete(m.clearedFields, user.FieldModel)
|
|
}
|
|
|
|
// SetModelAt sets the "model_at" field.
|
|
func (m *UserMutation) SetModelAt(t time.Time) {
|
|
m.model_at = &t
|
|
}
|
|
|
|
// ModelAt returns the value of the "model_at" field in the mutation.
|
|
func (m *UserMutation) ModelAt() (r time.Time, exists bool) {
|
|
v := m.model_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelAt returns the old "model_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelAt: %w", err)
|
|
}
|
|
return oldValue.ModelAt, nil
|
|
}
|
|
|
|
// ClearModelAt clears the value of the "model_at" field.
|
|
func (m *UserMutation) ClearModelAt() {
|
|
m.model_at = nil
|
|
m.clearedFields[user.FieldModelAt] = struct{}{}
|
|
}
|
|
|
|
// ModelAtCleared returns if the "model_at" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelAt resets all changes to the "model_at" field.
|
|
func (m *UserMutation) ResetModelAt() {
|
|
m.model_at = nil
|
|
delete(m.clearedFields, user.FieldModelAt)
|
|
}
|
|
|
|
// SetModelAttack sets the "model_attack" field.
|
|
func (m *UserMutation) SetModelAttack(i int) {
|
|
m.model_attack = &i
|
|
m.addmodel_attack = nil
|
|
}
|
|
|
|
// ModelAttack returns the value of the "model_attack" field in the mutation.
|
|
func (m *UserMutation) ModelAttack() (r int, exists bool) {
|
|
v := m.model_attack
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelAttack returns the old "model_attack" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelAttack(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelAttack is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelAttack requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelAttack: %w", err)
|
|
}
|
|
return oldValue.ModelAttack, nil
|
|
}
|
|
|
|
// AddModelAttack adds i to the "model_attack" field.
|
|
func (m *UserMutation) AddModelAttack(i int) {
|
|
if m.addmodel_attack != nil {
|
|
*m.addmodel_attack += i
|
|
} else {
|
|
m.addmodel_attack = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelAttack returns the value that was added to the "model_attack" field in this mutation.
|
|
func (m *UserMutation) AddedModelAttack() (r int, exists bool) {
|
|
v := m.addmodel_attack
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelAttack clears the value of the "model_attack" field.
|
|
func (m *UserMutation) ClearModelAttack() {
|
|
m.model_attack = nil
|
|
m.addmodel_attack = nil
|
|
m.clearedFields[user.FieldModelAttack] = struct{}{}
|
|
}
|
|
|
|
// ModelAttackCleared returns if the "model_attack" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelAttackCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelAttack]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelAttack resets all changes to the "model_attack" field.
|
|
func (m *UserMutation) ResetModelAttack() {
|
|
m.model_attack = nil
|
|
m.addmodel_attack = nil
|
|
delete(m.clearedFields, user.FieldModelAttack)
|
|
}
|
|
|
|
// SetModelLimit sets the "model_limit" field.
|
|
func (m *UserMutation) SetModelLimit(i int) {
|
|
m.model_limit = &i
|
|
m.addmodel_limit = nil
|
|
}
|
|
|
|
// ModelLimit returns the value of the "model_limit" field in the mutation.
|
|
func (m *UserMutation) ModelLimit() (r int, exists bool) {
|
|
v := m.model_limit
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelLimit returns the old "model_limit" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelLimit(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelLimit is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelLimit requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelLimit: %w", err)
|
|
}
|
|
return oldValue.ModelLimit, nil
|
|
}
|
|
|
|
// AddModelLimit adds i to the "model_limit" field.
|
|
func (m *UserMutation) AddModelLimit(i int) {
|
|
if m.addmodel_limit != nil {
|
|
*m.addmodel_limit += i
|
|
} else {
|
|
m.addmodel_limit = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelLimit returns the value that was added to the "model_limit" field in this mutation.
|
|
func (m *UserMutation) AddedModelLimit() (r int, exists bool) {
|
|
v := m.addmodel_limit
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelLimit clears the value of the "model_limit" field.
|
|
func (m *UserMutation) ClearModelLimit() {
|
|
m.model_limit = nil
|
|
m.addmodel_limit = nil
|
|
m.clearedFields[user.FieldModelLimit] = struct{}{}
|
|
}
|
|
|
|
// ModelLimitCleared returns if the "model_limit" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelLimitCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelLimit]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelLimit resets all changes to the "model_limit" field.
|
|
func (m *UserMutation) ResetModelLimit() {
|
|
m.model_limit = nil
|
|
m.addmodel_limit = nil
|
|
delete(m.clearedFields, user.FieldModelLimit)
|
|
}
|
|
|
|
// SetModelSkill sets the "model_skill" field.
|
|
func (m *UserMutation) SetModelSkill(i int) {
|
|
m.model_skill = &i
|
|
m.addmodel_skill = nil
|
|
}
|
|
|
|
// ModelSkill returns the value of the "model_skill" field in the mutation.
|
|
func (m *UserMutation) ModelSkill() (r int, exists bool) {
|
|
v := m.model_skill
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelSkill returns the old "model_skill" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelSkill(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelSkill is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelSkill requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelSkill: %w", err)
|
|
}
|
|
return oldValue.ModelSkill, nil
|
|
}
|
|
|
|
// AddModelSkill adds i to the "model_skill" field.
|
|
func (m *UserMutation) AddModelSkill(i int) {
|
|
if m.addmodel_skill != nil {
|
|
*m.addmodel_skill += i
|
|
} else {
|
|
m.addmodel_skill = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelSkill returns the value that was added to the "model_skill" field in this mutation.
|
|
func (m *UserMutation) AddedModelSkill() (r int, exists bool) {
|
|
v := m.addmodel_skill
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelSkill clears the value of the "model_skill" field.
|
|
func (m *UserMutation) ClearModelSkill() {
|
|
m.model_skill = nil
|
|
m.addmodel_skill = nil
|
|
m.clearedFields[user.FieldModelSkill] = struct{}{}
|
|
}
|
|
|
|
// ModelSkillCleared returns if the "model_skill" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelSkillCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelSkill]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelSkill resets all changes to the "model_skill" field.
|
|
func (m *UserMutation) ResetModelSkill() {
|
|
m.model_skill = nil
|
|
m.addmodel_skill = nil
|
|
delete(m.clearedFields, user.FieldModelSkill)
|
|
}
|
|
|
|
// SetModelMode sets the "model_mode" field.
|
|
func (m *UserMutation) SetModelMode(i int) {
|
|
m.model_mode = &i
|
|
m.addmodel_mode = nil
|
|
}
|
|
|
|
// ModelMode returns the value of the "model_mode" field in the mutation.
|
|
func (m *UserMutation) ModelMode() (r int, exists bool) {
|
|
v := m.model_mode
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelMode returns the old "model_mode" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelMode(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelMode is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelMode requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelMode: %w", err)
|
|
}
|
|
return oldValue.ModelMode, nil
|
|
}
|
|
|
|
// AddModelMode adds i to the "model_mode" field.
|
|
func (m *UserMutation) AddModelMode(i int) {
|
|
if m.addmodel_mode != nil {
|
|
*m.addmodel_mode += i
|
|
} else {
|
|
m.addmodel_mode = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelMode returns the value that was added to the "model_mode" field in this mutation.
|
|
func (m *UserMutation) AddedModelMode() (r int, exists bool) {
|
|
v := m.addmodel_mode
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelMode clears the value of the "model_mode" field.
|
|
func (m *UserMutation) ClearModelMode() {
|
|
m.model_mode = nil
|
|
m.addmodel_mode = nil
|
|
m.clearedFields[user.FieldModelMode] = struct{}{}
|
|
}
|
|
|
|
// ModelModeCleared returns if the "model_mode" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelModeCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelMode]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelMode resets all changes to the "model_mode" field.
|
|
func (m *UserMutation) ResetModelMode() {
|
|
m.model_mode = nil
|
|
m.addmodel_mode = nil
|
|
delete(m.clearedFields, user.FieldModelMode)
|
|
}
|
|
|
|
// SetModelCritical sets the "model_critical" field.
|
|
func (m *UserMutation) SetModelCritical(i int) {
|
|
m.model_critical = &i
|
|
m.addmodel_critical = nil
|
|
}
|
|
|
|
// ModelCritical returns the value of the "model_critical" field in the mutation.
|
|
func (m *UserMutation) ModelCritical() (r int, exists bool) {
|
|
v := m.model_critical
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelCritical returns the old "model_critical" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelCritical(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelCritical is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelCritical requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelCritical: %w", err)
|
|
}
|
|
return oldValue.ModelCritical, nil
|
|
}
|
|
|
|
// AddModelCritical adds i to the "model_critical" field.
|
|
func (m *UserMutation) AddModelCritical(i int) {
|
|
if m.addmodel_critical != nil {
|
|
*m.addmodel_critical += i
|
|
} else {
|
|
m.addmodel_critical = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelCritical returns the value that was added to the "model_critical" field in this mutation.
|
|
func (m *UserMutation) AddedModelCritical() (r int, exists bool) {
|
|
v := m.addmodel_critical
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelCritical clears the value of the "model_critical" field.
|
|
func (m *UserMutation) ClearModelCritical() {
|
|
m.model_critical = nil
|
|
m.addmodel_critical = nil
|
|
m.clearedFields[user.FieldModelCritical] = struct{}{}
|
|
}
|
|
|
|
// ModelCriticalCleared returns if the "model_critical" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelCriticalCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelCritical]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelCritical resets all changes to the "model_critical" field.
|
|
func (m *UserMutation) ResetModelCritical() {
|
|
m.model_critical = nil
|
|
m.addmodel_critical = nil
|
|
delete(m.clearedFields, user.FieldModelCritical)
|
|
}
|
|
|
|
// SetModelCriticalD sets the "model_critical_d" field.
|
|
func (m *UserMutation) SetModelCriticalD(i int) {
|
|
m.model_critical_d = &i
|
|
m.addmodel_critical_d = nil
|
|
}
|
|
|
|
// ModelCriticalD returns the value of the "model_critical_d" field in the mutation.
|
|
func (m *UserMutation) ModelCriticalD() (r int, exists bool) {
|
|
v := m.model_critical_d
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldModelCriticalD returns the old "model_critical_d" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldModelCriticalD(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldModelCriticalD is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldModelCriticalD requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldModelCriticalD: %w", err)
|
|
}
|
|
return oldValue.ModelCriticalD, nil
|
|
}
|
|
|
|
// AddModelCriticalD adds i to the "model_critical_d" field.
|
|
func (m *UserMutation) AddModelCriticalD(i int) {
|
|
if m.addmodel_critical_d != nil {
|
|
*m.addmodel_critical_d += i
|
|
} else {
|
|
m.addmodel_critical_d = &i
|
|
}
|
|
}
|
|
|
|
// AddedModelCriticalD returns the value that was added to the "model_critical_d" field in this mutation.
|
|
func (m *UserMutation) AddedModelCriticalD() (r int, exists bool) {
|
|
v := m.addmodel_critical_d
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearModelCriticalD clears the value of the "model_critical_d" field.
|
|
func (m *UserMutation) ClearModelCriticalD() {
|
|
m.model_critical_d = nil
|
|
m.addmodel_critical_d = nil
|
|
m.clearedFields[user.FieldModelCriticalD] = struct{}{}
|
|
}
|
|
|
|
// ModelCriticalDCleared returns if the "model_critical_d" field was cleared in this mutation.
|
|
func (m *UserMutation) ModelCriticalDCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldModelCriticalD]
|
|
return ok
|
|
}
|
|
|
|
// ResetModelCriticalD resets all changes to the "model_critical_d" field.
|
|
func (m *UserMutation) ResetModelCriticalD() {
|
|
m.model_critical_d = nil
|
|
m.addmodel_critical_d = nil
|
|
delete(m.clearedFields, user.FieldModelCriticalD)
|
|
}
|
|
|
|
// SetGame sets the "game" field.
|
|
func (m *UserMutation) SetGame(b bool) {
|
|
m.game = &b
|
|
}
|
|
|
|
// Game returns the value of the "game" field in the mutation.
|
|
func (m *UserMutation) Game() (r bool, exists bool) {
|
|
v := m.game
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGame returns the old "game" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldGame(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldGame is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldGame requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldGame: %w", err)
|
|
}
|
|
return oldValue.Game, nil
|
|
}
|
|
|
|
// ClearGame clears the value of the "game" field.
|
|
func (m *UserMutation) ClearGame() {
|
|
m.game = nil
|
|
m.clearedFields[user.FieldGame] = struct{}{}
|
|
}
|
|
|
|
// GameCleared returns if the "game" field was cleared in this mutation.
|
|
func (m *UserMutation) GameCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldGame]
|
|
return ok
|
|
}
|
|
|
|
// ResetGame resets all changes to the "game" field.
|
|
func (m *UserMutation) ResetGame() {
|
|
m.game = nil
|
|
delete(m.clearedFields, user.FieldGame)
|
|
}
|
|
|
|
// SetGameTest sets the "game_test" field.
|
|
func (m *UserMutation) SetGameTest(b bool) {
|
|
m.game_test = &b
|
|
}
|
|
|
|
// GameTest returns the value of the "game_test" field in the mutation.
|
|
func (m *UserMutation) GameTest() (r bool, exists bool) {
|
|
v := m.game_test
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGameTest returns the old "game_test" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldGameTest(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldGameTest is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldGameTest requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldGameTest: %w", err)
|
|
}
|
|
return oldValue.GameTest, nil
|
|
}
|
|
|
|
// ClearGameTest clears the value of the "game_test" field.
|
|
func (m *UserMutation) ClearGameTest() {
|
|
m.game_test = nil
|
|
m.clearedFields[user.FieldGameTest] = struct{}{}
|
|
}
|
|
|
|
// GameTestCleared returns if the "game_test" field was cleared in this mutation.
|
|
func (m *UserMutation) GameTestCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldGameTest]
|
|
return ok
|
|
}
|
|
|
|
// ResetGameTest resets all changes to the "game_test" field.
|
|
func (m *UserMutation) ResetGameTest() {
|
|
m.game_test = nil
|
|
delete(m.clearedFields, user.FieldGameTest)
|
|
}
|
|
|
|
// SetGameEnd sets the "game_end" field.
|
|
func (m *UserMutation) SetGameEnd(b bool) {
|
|
m.game_end = &b
|
|
}
|
|
|
|
// GameEnd returns the value of the "game_end" field in the mutation.
|
|
func (m *UserMutation) GameEnd() (r bool, exists bool) {
|
|
v := m.game_end
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGameEnd returns the old "game_end" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldGameEnd(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldGameEnd is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldGameEnd requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldGameEnd: %w", err)
|
|
}
|
|
return oldValue.GameEnd, nil
|
|
}
|
|
|
|
// ClearGameEnd clears the value of the "game_end" field.
|
|
func (m *UserMutation) ClearGameEnd() {
|
|
m.game_end = nil
|
|
m.clearedFields[user.FieldGameEnd] = struct{}{}
|
|
}
|
|
|
|
// GameEndCleared returns if the "game_end" field was cleared in this mutation.
|
|
func (m *UserMutation) GameEndCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldGameEnd]
|
|
return ok
|
|
}
|
|
|
|
// ResetGameEnd resets all changes to the "game_end" field.
|
|
func (m *UserMutation) ResetGameEnd() {
|
|
m.game_end = nil
|
|
delete(m.clearedFields, user.FieldGameEnd)
|
|
}
|
|
|
|
// SetGameAccount sets the "game_account" field.
|
|
func (m *UserMutation) SetGameAccount(b bool) {
|
|
m.game_account = &b
|
|
}
|
|
|
|
// GameAccount returns the value of the "game_account" field in the mutation.
|
|
func (m *UserMutation) GameAccount() (r bool, exists bool) {
|
|
v := m.game_account
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGameAccount returns the old "game_account" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldGameAccount(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldGameAccount is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldGameAccount requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldGameAccount: %w", err)
|
|
}
|
|
return oldValue.GameAccount, nil
|
|
}
|
|
|
|
// ClearGameAccount clears the value of the "game_account" field.
|
|
func (m *UserMutation) ClearGameAccount() {
|
|
m.game_account = nil
|
|
m.clearedFields[user.FieldGameAccount] = struct{}{}
|
|
}
|
|
|
|
// GameAccountCleared returns if the "game_account" field was cleared in this mutation.
|
|
func (m *UserMutation) GameAccountCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldGameAccount]
|
|
return ok
|
|
}
|
|
|
|
// ResetGameAccount resets all changes to the "game_account" field.
|
|
func (m *UserMutation) ResetGameAccount() {
|
|
m.game_account = nil
|
|
delete(m.clearedFields, user.FieldGameAccount)
|
|
}
|
|
|
|
// SetGameLv sets the "game_lv" field.
|
|
func (m *UserMutation) SetGameLv(i int) {
|
|
m.game_lv = &i
|
|
m.addgame_lv = nil
|
|
}
|
|
|
|
// GameLv returns the value of the "game_lv" field in the mutation.
|
|
func (m *UserMutation) GameLv() (r int, exists bool) {
|
|
v := m.game_lv
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldGameLv returns the old "game_lv" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldGameLv(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldGameLv is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldGameLv requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldGameLv: %w", err)
|
|
}
|
|
return oldValue.GameLv, nil
|
|
}
|
|
|
|
// AddGameLv adds i to the "game_lv" field.
|
|
func (m *UserMutation) AddGameLv(i int) {
|
|
if m.addgame_lv != nil {
|
|
*m.addgame_lv += i
|
|
} else {
|
|
m.addgame_lv = &i
|
|
}
|
|
}
|
|
|
|
// AddedGameLv returns the value that was added to the "game_lv" field in this mutation.
|
|
func (m *UserMutation) AddedGameLv() (r int, exists bool) {
|
|
v := m.addgame_lv
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearGameLv clears the value of the "game_lv" field.
|
|
func (m *UserMutation) ClearGameLv() {
|
|
m.game_lv = nil
|
|
m.addgame_lv = nil
|
|
m.clearedFields[user.FieldGameLv] = struct{}{}
|
|
}
|
|
|
|
// GameLvCleared returns if the "game_lv" field was cleared in this mutation.
|
|
func (m *UserMutation) GameLvCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldGameLv]
|
|
return ok
|
|
}
|
|
|
|
// ResetGameLv resets all changes to the "game_lv" field.
|
|
func (m *UserMutation) ResetGameLv() {
|
|
m.game_lv = nil
|
|
m.addgame_lv = nil
|
|
delete(m.clearedFields, user.FieldGameLv)
|
|
}
|
|
|
|
// SetCoin sets the "coin" field.
|
|
func (m *UserMutation) SetCoin(i int) {
|
|
m.coin = &i
|
|
m.addcoin = nil
|
|
}
|
|
|
|
// Coin returns the value of the "coin" field in the mutation.
|
|
func (m *UserMutation) Coin() (r int, exists bool) {
|
|
v := m.coin
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCoin returns the old "coin" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldCoin(ctx context.Context) (v int, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCoin is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCoin requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCoin: %w", err)
|
|
}
|
|
return oldValue.Coin, nil
|
|
}
|
|
|
|
// AddCoin adds i to the "coin" field.
|
|
func (m *UserMutation) AddCoin(i int) {
|
|
if m.addcoin != nil {
|
|
*m.addcoin += i
|
|
} else {
|
|
m.addcoin = &i
|
|
}
|
|
}
|
|
|
|
// AddedCoin returns the value that was added to the "coin" field in this mutation.
|
|
func (m *UserMutation) AddedCoin() (r int, exists bool) {
|
|
v := m.addcoin
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCoin clears the value of the "coin" field.
|
|
func (m *UserMutation) ClearCoin() {
|
|
m.coin = nil
|
|
m.addcoin = nil
|
|
m.clearedFields[user.FieldCoin] = struct{}{}
|
|
}
|
|
|
|
// CoinCleared returns if the "coin" field was cleared in this mutation.
|
|
func (m *UserMutation) CoinCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldCoin]
|
|
return ok
|
|
}
|
|
|
|
// ResetCoin resets all changes to the "coin" field.
|
|
func (m *UserMutation) ResetCoin() {
|
|
m.coin = nil
|
|
m.addcoin = nil
|
|
delete(m.clearedFields, user.FieldCoin)
|
|
}
|
|
|
|
// SetCoinOpen sets the "coin_open" field.
|
|
func (m *UserMutation) SetCoinOpen(b bool) {
|
|
m.coin_open = &b
|
|
}
|
|
|
|
// CoinOpen returns the value of the "coin_open" field in the mutation.
|
|
func (m *UserMutation) CoinOpen() (r bool, exists bool) {
|
|
v := m.coin_open
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCoinOpen returns the old "coin_open" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldCoinOpen(ctx context.Context) (v bool, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCoinOpen is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCoinOpen requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCoinOpen: %w", err)
|
|
}
|
|
return oldValue.CoinOpen, nil
|
|
}
|
|
|
|
// ClearCoinOpen clears the value of the "coin_open" field.
|
|
func (m *UserMutation) ClearCoinOpen() {
|
|
m.coin_open = nil
|
|
m.clearedFields[user.FieldCoinOpen] = struct{}{}
|
|
}
|
|
|
|
// CoinOpenCleared returns if the "coin_open" field was cleared in this mutation.
|
|
func (m *UserMutation) CoinOpenCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldCoinOpen]
|
|
return ok
|
|
}
|
|
|
|
// ResetCoinOpen resets all changes to the "coin_open" field.
|
|
func (m *UserMutation) ResetCoinOpen() {
|
|
m.coin_open = nil
|
|
delete(m.clearedFields, user.FieldCoinOpen)
|
|
}
|
|
|
|
// SetCoinAt sets the "coin_at" field.
|
|
func (m *UserMutation) SetCoinAt(t time.Time) {
|
|
m.coin_at = &t
|
|
}
|
|
|
|
// CoinAt returns the value of the "coin_at" field in the mutation.
|
|
func (m *UserMutation) CoinAt() (r time.Time, exists bool) {
|
|
v := m.coin_at
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// OldCoinAt returns the old "coin_at" field's value of the User entity.
|
|
// If the User 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 *UserMutation) OldCoinAt(ctx context.Context) (v time.Time, err error) {
|
|
if !m.op.Is(OpUpdateOne) {
|
|
return v, errors.New("OldCoinAt is only allowed on UpdateOne operations")
|
|
}
|
|
if m.id == nil || m.oldValue == nil {
|
|
return v, errors.New("OldCoinAt requires an ID field in the mutation")
|
|
}
|
|
oldValue, err := m.oldValue(ctx)
|
|
if err != nil {
|
|
return v, fmt.Errorf("querying old value for OldCoinAt: %w", err)
|
|
}
|
|
return oldValue.CoinAt, nil
|
|
}
|
|
|
|
// ClearCoinAt clears the value of the "coin_at" field.
|
|
func (m *UserMutation) ClearCoinAt() {
|
|
m.coin_at = nil
|
|
m.clearedFields[user.FieldCoinAt] = struct{}{}
|
|
}
|
|
|
|
// CoinAtCleared returns if the "coin_at" field was cleared in this mutation.
|
|
func (m *UserMutation) CoinAtCleared() bool {
|
|
_, ok := m.clearedFields[user.FieldCoinAt]
|
|
return ok
|
|
}
|
|
|
|
// ResetCoinAt resets all changes to the "coin_at" field.
|
|
func (m *UserMutation) ResetCoinAt() {
|
|
m.coin_at = nil
|
|
delete(m.clearedFields, user.FieldCoinAt)
|
|
}
|
|
|
|
// AddCardIDs adds the "card" edge to the Card entity by ids.
|
|
func (m *UserMutation) AddCardIDs(ids ...int) {
|
|
if m.card == nil {
|
|
m.card = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.card[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearCard clears the "card" edge to the Card entity.
|
|
func (m *UserMutation) ClearCard() {
|
|
m.clearedcard = true
|
|
}
|
|
|
|
// CardCleared reports if the "card" edge to the Card entity was cleared.
|
|
func (m *UserMutation) CardCleared() bool {
|
|
return m.clearedcard
|
|
}
|
|
|
|
// RemoveCardIDs removes the "card" edge to the Card entity by IDs.
|
|
func (m *UserMutation) RemoveCardIDs(ids ...int) {
|
|
if m.removedcard == nil {
|
|
m.removedcard = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.card, ids[i])
|
|
m.removedcard[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedCard returns the removed IDs of the "card" edge to the Card entity.
|
|
func (m *UserMutation) RemovedCardIDs() (ids []int) {
|
|
for id := range m.removedcard {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// CardIDs returns the "card" edge IDs in the mutation.
|
|
func (m *UserMutation) CardIDs() (ids []int) {
|
|
for id := range m.card {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetCard resets all changes to the "card" edge.
|
|
func (m *UserMutation) ResetCard() {
|
|
m.card = nil
|
|
m.clearedcard = false
|
|
m.removedcard = nil
|
|
}
|
|
|
|
// AddUeIDs adds the "ue" edge to the Ue entity by ids.
|
|
func (m *UserMutation) AddUeIDs(ids ...int) {
|
|
if m.ue == nil {
|
|
m.ue = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
m.ue[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// ClearUe clears the "ue" edge to the Ue entity.
|
|
func (m *UserMutation) ClearUe() {
|
|
m.clearedue = true
|
|
}
|
|
|
|
// UeCleared reports if the "ue" edge to the Ue entity was cleared.
|
|
func (m *UserMutation) UeCleared() bool {
|
|
return m.clearedue
|
|
}
|
|
|
|
// RemoveUeIDs removes the "ue" edge to the Ue entity by IDs.
|
|
func (m *UserMutation) RemoveUeIDs(ids ...int) {
|
|
if m.removedue == nil {
|
|
m.removedue = make(map[int]struct{})
|
|
}
|
|
for i := range ids {
|
|
delete(m.ue, ids[i])
|
|
m.removedue[ids[i]] = struct{}{}
|
|
}
|
|
}
|
|
|
|
// RemovedUe returns the removed IDs of the "ue" edge to the Ue entity.
|
|
func (m *UserMutation) RemovedUeIDs() (ids []int) {
|
|
for id := range m.removedue {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// UeIDs returns the "ue" edge IDs in the mutation.
|
|
func (m *UserMutation) UeIDs() (ids []int) {
|
|
for id := range m.ue {
|
|
ids = append(ids, id)
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResetUe resets all changes to the "ue" edge.
|
|
func (m *UserMutation) ResetUe() {
|
|
m.ue = nil
|
|
m.clearedue = false
|
|
m.removedue = nil
|
|
}
|
|
|
|
// Where appends a list predicates to the UserMutation builder.
|
|
func (m *UserMutation) Where(ps ...predicate.User) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the UserMutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *UserMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
p := make([]predicate.User, len(ps))
|
|
for i := range ps {
|
|
p[i] = ps[i]
|
|
}
|
|
m.Where(p...)
|
|
}
|
|
|
|
// Op returns the operation name.
|
|
func (m *UserMutation) Op() Op {
|
|
return m.op
|
|
}
|
|
|
|
// SetOp allows setting the mutation operation.
|
|
func (m *UserMutation) SetOp(op Op) {
|
|
m.op = op
|
|
}
|
|
|
|
// Type returns the node type of this mutation (User).
|
|
func (m *UserMutation) 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 *UserMutation) Fields() []string {
|
|
fields := make([]string, 0, 50)
|
|
if m.username != nil {
|
|
fields = append(fields, user.FieldUsername)
|
|
}
|
|
if m.did != nil {
|
|
fields = append(fields, user.FieldDid)
|
|
}
|
|
if m.member != nil {
|
|
fields = append(fields, user.FieldMember)
|
|
}
|
|
if m.book != nil {
|
|
fields = append(fields, user.FieldBook)
|
|
}
|
|
if m.manga != nil {
|
|
fields = append(fields, user.FieldManga)
|
|
}
|
|
if m.badge != nil {
|
|
fields = append(fields, user.FieldBadge)
|
|
}
|
|
if m.bsky != nil {
|
|
fields = append(fields, user.FieldBsky)
|
|
}
|
|
if m.mastodon != nil {
|
|
fields = append(fields, user.FieldMastodon)
|
|
}
|
|
if m.delete != nil {
|
|
fields = append(fields, user.FieldDelete)
|
|
}
|
|
if m.handle != nil {
|
|
fields = append(fields, user.FieldHandle)
|
|
}
|
|
if m.token != nil {
|
|
fields = append(fields, user.FieldToken)
|
|
}
|
|
if m.password != nil {
|
|
fields = append(fields, user.FieldPassword)
|
|
}
|
|
if m.created_at != nil {
|
|
fields = append(fields, user.FieldCreatedAt)
|
|
}
|
|
if m.updated_at != nil {
|
|
fields = append(fields, user.FieldUpdatedAt)
|
|
}
|
|
if m.raid_at != nil {
|
|
fields = append(fields, user.FieldRaidAt)
|
|
}
|
|
if m.server_at != nil {
|
|
fields = append(fields, user.FieldServerAt)
|
|
}
|
|
if m.egg_at != nil {
|
|
fields = append(fields, user.FieldEggAt)
|
|
}
|
|
if m.luck != nil {
|
|
fields = append(fields, user.FieldLuck)
|
|
}
|
|
if m.luck_at != nil {
|
|
fields = append(fields, user.FieldLuckAt)
|
|
}
|
|
if m.like != nil {
|
|
fields = append(fields, user.FieldLike)
|
|
}
|
|
if m.like_rank != nil {
|
|
fields = append(fields, user.FieldLikeRank)
|
|
}
|
|
if m.like_at != nil {
|
|
fields = append(fields, user.FieldLikeAt)
|
|
}
|
|
if m.fav != nil {
|
|
fields = append(fields, user.FieldFav)
|
|
}
|
|
if m.ten != nil {
|
|
fields = append(fields, user.FieldTen)
|
|
}
|
|
if m.ten_su != nil {
|
|
fields = append(fields, user.FieldTenSu)
|
|
}
|
|
if m.ten_kai != nil {
|
|
fields = append(fields, user.FieldTenKai)
|
|
}
|
|
if m.aiten != nil {
|
|
fields = append(fields, user.FieldAiten)
|
|
}
|
|
if m.ten_card != nil {
|
|
fields = append(fields, user.FieldTenCard)
|
|
}
|
|
if m.ten_delete != nil {
|
|
fields = append(fields, user.FieldTenDelete)
|
|
}
|
|
if m.ten_post != nil {
|
|
fields = append(fields, user.FieldTenPost)
|
|
}
|
|
if m.ten_get != nil {
|
|
fields = append(fields, user.FieldTenGet)
|
|
}
|
|
if m.ten_at != nil {
|
|
fields = append(fields, user.FieldTenAt)
|
|
}
|
|
if m.next != nil {
|
|
fields = append(fields, user.FieldNext)
|
|
}
|
|
if m.room != nil {
|
|
fields = append(fields, user.FieldRoom)
|
|
}
|
|
if m.model != nil {
|
|
fields = append(fields, user.FieldModel)
|
|
}
|
|
if m.model_at != nil {
|
|
fields = append(fields, user.FieldModelAt)
|
|
}
|
|
if m.model_attack != nil {
|
|
fields = append(fields, user.FieldModelAttack)
|
|
}
|
|
if m.model_limit != nil {
|
|
fields = append(fields, user.FieldModelLimit)
|
|
}
|
|
if m.model_skill != nil {
|
|
fields = append(fields, user.FieldModelSkill)
|
|
}
|
|
if m.model_mode != nil {
|
|
fields = append(fields, user.FieldModelMode)
|
|
}
|
|
if m.model_critical != nil {
|
|
fields = append(fields, user.FieldModelCritical)
|
|
}
|
|
if m.model_critical_d != nil {
|
|
fields = append(fields, user.FieldModelCriticalD)
|
|
}
|
|
if m.game != nil {
|
|
fields = append(fields, user.FieldGame)
|
|
}
|
|
if m.game_test != nil {
|
|
fields = append(fields, user.FieldGameTest)
|
|
}
|
|
if m.game_end != nil {
|
|
fields = append(fields, user.FieldGameEnd)
|
|
}
|
|
if m.game_account != nil {
|
|
fields = append(fields, user.FieldGameAccount)
|
|
}
|
|
if m.game_lv != nil {
|
|
fields = append(fields, user.FieldGameLv)
|
|
}
|
|
if m.coin != nil {
|
|
fields = append(fields, user.FieldCoin)
|
|
}
|
|
if m.coin_open != nil {
|
|
fields = append(fields, user.FieldCoinOpen)
|
|
}
|
|
if m.coin_at != nil {
|
|
fields = append(fields, user.FieldCoinAt)
|
|
}
|
|
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 *UserMutation) Field(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case user.FieldUsername:
|
|
return m.Username()
|
|
case user.FieldDid:
|
|
return m.Did()
|
|
case user.FieldMember:
|
|
return m.Member()
|
|
case user.FieldBook:
|
|
return m.Book()
|
|
case user.FieldManga:
|
|
return m.Manga()
|
|
case user.FieldBadge:
|
|
return m.Badge()
|
|
case user.FieldBsky:
|
|
return m.Bsky()
|
|
case user.FieldMastodon:
|
|
return m.Mastodon()
|
|
case user.FieldDelete:
|
|
return m.Delete()
|
|
case user.FieldHandle:
|
|
return m.Handle()
|
|
case user.FieldToken:
|
|
return m.Token()
|
|
case user.FieldPassword:
|
|
return m.Password()
|
|
case user.FieldCreatedAt:
|
|
return m.CreatedAt()
|
|
case user.FieldUpdatedAt:
|
|
return m.UpdatedAt()
|
|
case user.FieldRaidAt:
|
|
return m.RaidAt()
|
|
case user.FieldServerAt:
|
|
return m.ServerAt()
|
|
case user.FieldEggAt:
|
|
return m.EggAt()
|
|
case user.FieldLuck:
|
|
return m.Luck()
|
|
case user.FieldLuckAt:
|
|
return m.LuckAt()
|
|
case user.FieldLike:
|
|
return m.Like()
|
|
case user.FieldLikeRank:
|
|
return m.LikeRank()
|
|
case user.FieldLikeAt:
|
|
return m.LikeAt()
|
|
case user.FieldFav:
|
|
return m.Fav()
|
|
case user.FieldTen:
|
|
return m.Ten()
|
|
case user.FieldTenSu:
|
|
return m.TenSu()
|
|
case user.FieldTenKai:
|
|
return m.TenKai()
|
|
case user.FieldAiten:
|
|
return m.Aiten()
|
|
case user.FieldTenCard:
|
|
return m.TenCard()
|
|
case user.FieldTenDelete:
|
|
return m.TenDelete()
|
|
case user.FieldTenPost:
|
|
return m.TenPost()
|
|
case user.FieldTenGet:
|
|
return m.TenGet()
|
|
case user.FieldTenAt:
|
|
return m.TenAt()
|
|
case user.FieldNext:
|
|
return m.Next()
|
|
case user.FieldRoom:
|
|
return m.Room()
|
|
case user.FieldModel:
|
|
return m.Model()
|
|
case user.FieldModelAt:
|
|
return m.ModelAt()
|
|
case user.FieldModelAttack:
|
|
return m.ModelAttack()
|
|
case user.FieldModelLimit:
|
|
return m.ModelLimit()
|
|
case user.FieldModelSkill:
|
|
return m.ModelSkill()
|
|
case user.FieldModelMode:
|
|
return m.ModelMode()
|
|
case user.FieldModelCritical:
|
|
return m.ModelCritical()
|
|
case user.FieldModelCriticalD:
|
|
return m.ModelCriticalD()
|
|
case user.FieldGame:
|
|
return m.Game()
|
|
case user.FieldGameTest:
|
|
return m.GameTest()
|
|
case user.FieldGameEnd:
|
|
return m.GameEnd()
|
|
case user.FieldGameAccount:
|
|
return m.GameAccount()
|
|
case user.FieldGameLv:
|
|
return m.GameLv()
|
|
case user.FieldCoin:
|
|
return m.Coin()
|
|
case user.FieldCoinOpen:
|
|
return m.CoinOpen()
|
|
case user.FieldCoinAt:
|
|
return m.CoinAt()
|
|
}
|
|
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 *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
switch name {
|
|
case user.FieldUsername:
|
|
return m.OldUsername(ctx)
|
|
case user.FieldDid:
|
|
return m.OldDid(ctx)
|
|
case user.FieldMember:
|
|
return m.OldMember(ctx)
|
|
case user.FieldBook:
|
|
return m.OldBook(ctx)
|
|
case user.FieldManga:
|
|
return m.OldManga(ctx)
|
|
case user.FieldBadge:
|
|
return m.OldBadge(ctx)
|
|
case user.FieldBsky:
|
|
return m.OldBsky(ctx)
|
|
case user.FieldMastodon:
|
|
return m.OldMastodon(ctx)
|
|
case user.FieldDelete:
|
|
return m.OldDelete(ctx)
|
|
case user.FieldHandle:
|
|
return m.OldHandle(ctx)
|
|
case user.FieldToken:
|
|
return m.OldToken(ctx)
|
|
case user.FieldPassword:
|
|
return m.OldPassword(ctx)
|
|
case user.FieldCreatedAt:
|
|
return m.OldCreatedAt(ctx)
|
|
case user.FieldUpdatedAt:
|
|
return m.OldUpdatedAt(ctx)
|
|
case user.FieldRaidAt:
|
|
return m.OldRaidAt(ctx)
|
|
case user.FieldServerAt:
|
|
return m.OldServerAt(ctx)
|
|
case user.FieldEggAt:
|
|
return m.OldEggAt(ctx)
|
|
case user.FieldLuck:
|
|
return m.OldLuck(ctx)
|
|
case user.FieldLuckAt:
|
|
return m.OldLuckAt(ctx)
|
|
case user.FieldLike:
|
|
return m.OldLike(ctx)
|
|
case user.FieldLikeRank:
|
|
return m.OldLikeRank(ctx)
|
|
case user.FieldLikeAt:
|
|
return m.OldLikeAt(ctx)
|
|
case user.FieldFav:
|
|
return m.OldFav(ctx)
|
|
case user.FieldTen:
|
|
return m.OldTen(ctx)
|
|
case user.FieldTenSu:
|
|
return m.OldTenSu(ctx)
|
|
case user.FieldTenKai:
|
|
return m.OldTenKai(ctx)
|
|
case user.FieldAiten:
|
|
return m.OldAiten(ctx)
|
|
case user.FieldTenCard:
|
|
return m.OldTenCard(ctx)
|
|
case user.FieldTenDelete:
|
|
return m.OldTenDelete(ctx)
|
|
case user.FieldTenPost:
|
|
return m.OldTenPost(ctx)
|
|
case user.FieldTenGet:
|
|
return m.OldTenGet(ctx)
|
|
case user.FieldTenAt:
|
|
return m.OldTenAt(ctx)
|
|
case user.FieldNext:
|
|
return m.OldNext(ctx)
|
|
case user.FieldRoom:
|
|
return m.OldRoom(ctx)
|
|
case user.FieldModel:
|
|
return m.OldModel(ctx)
|
|
case user.FieldModelAt:
|
|
return m.OldModelAt(ctx)
|
|
case user.FieldModelAttack:
|
|
return m.OldModelAttack(ctx)
|
|
case user.FieldModelLimit:
|
|
return m.OldModelLimit(ctx)
|
|
case user.FieldModelSkill:
|
|
return m.OldModelSkill(ctx)
|
|
case user.FieldModelMode:
|
|
return m.OldModelMode(ctx)
|
|
case user.FieldModelCritical:
|
|
return m.OldModelCritical(ctx)
|
|
case user.FieldModelCriticalD:
|
|
return m.OldModelCriticalD(ctx)
|
|
case user.FieldGame:
|
|
return m.OldGame(ctx)
|
|
case user.FieldGameTest:
|
|
return m.OldGameTest(ctx)
|
|
case user.FieldGameEnd:
|
|
return m.OldGameEnd(ctx)
|
|
case user.FieldGameAccount:
|
|
return m.OldGameAccount(ctx)
|
|
case user.FieldGameLv:
|
|
return m.OldGameLv(ctx)
|
|
case user.FieldCoin:
|
|
return m.OldCoin(ctx)
|
|
case user.FieldCoinOpen:
|
|
return m.OldCoinOpen(ctx)
|
|
case user.FieldCoinAt:
|
|
return m.OldCoinAt(ctx)
|
|
}
|
|
return nil, fmt.Errorf("unknown User 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 *UserMutation) SetField(name string, value ent.Value) error {
|
|
switch name {
|
|
case user.FieldUsername:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUsername(v)
|
|
return nil
|
|
case user.FieldDid:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDid(v)
|
|
return nil
|
|
case user.FieldMember:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMember(v)
|
|
return nil
|
|
case user.FieldBook:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBook(v)
|
|
return nil
|
|
case user.FieldManga:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetManga(v)
|
|
return nil
|
|
case user.FieldBadge:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBadge(v)
|
|
return nil
|
|
case user.FieldBsky:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBsky(v)
|
|
return nil
|
|
case user.FieldMastodon:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetMastodon(v)
|
|
return nil
|
|
case user.FieldDelete:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetDelete(v)
|
|
return nil
|
|
case user.FieldHandle:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetHandle(v)
|
|
return nil
|
|
case user.FieldToken:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetToken(v)
|
|
return nil
|
|
case user.FieldPassword:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetPassword(v)
|
|
return nil
|
|
case user.FieldCreatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCreatedAt(v)
|
|
return nil
|
|
case user.FieldUpdatedAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetUpdatedAt(v)
|
|
return nil
|
|
case user.FieldRaidAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRaidAt(v)
|
|
return nil
|
|
case user.FieldServerAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetServerAt(v)
|
|
return nil
|
|
case user.FieldEggAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetEggAt(v)
|
|
return nil
|
|
case user.FieldLuck:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLuck(v)
|
|
return nil
|
|
case user.FieldLuckAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLuckAt(v)
|
|
return nil
|
|
case user.FieldLike:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLike(v)
|
|
return nil
|
|
case user.FieldLikeRank:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLikeRank(v)
|
|
return nil
|
|
case user.FieldLikeAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetLikeAt(v)
|
|
return nil
|
|
case user.FieldFav:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetFav(v)
|
|
return nil
|
|
case user.FieldTen:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTen(v)
|
|
return nil
|
|
case user.FieldTenSu:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenSu(v)
|
|
return nil
|
|
case user.FieldTenKai:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenKai(v)
|
|
return nil
|
|
case user.FieldAiten:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetAiten(v)
|
|
return nil
|
|
case user.FieldTenCard:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenCard(v)
|
|
return nil
|
|
case user.FieldTenDelete:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenDelete(v)
|
|
return nil
|
|
case user.FieldTenPost:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenPost(v)
|
|
return nil
|
|
case user.FieldTenGet:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenGet(v)
|
|
return nil
|
|
case user.FieldTenAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTenAt(v)
|
|
return nil
|
|
case user.FieldNext:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetNext(v)
|
|
return nil
|
|
case user.FieldRoom:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetRoom(v)
|
|
return nil
|
|
case user.FieldModel:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModel(v)
|
|
return nil
|
|
case user.FieldModelAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelAt(v)
|
|
return nil
|
|
case user.FieldModelAttack:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelAttack(v)
|
|
return nil
|
|
case user.FieldModelLimit:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelLimit(v)
|
|
return nil
|
|
case user.FieldModelSkill:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelSkill(v)
|
|
return nil
|
|
case user.FieldModelMode:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelMode(v)
|
|
return nil
|
|
case user.FieldModelCritical:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelCritical(v)
|
|
return nil
|
|
case user.FieldModelCriticalD:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetModelCriticalD(v)
|
|
return nil
|
|
case user.FieldGame:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGame(v)
|
|
return nil
|
|
case user.FieldGameTest:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGameTest(v)
|
|
return nil
|
|
case user.FieldGameEnd:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGameEnd(v)
|
|
return nil
|
|
case user.FieldGameAccount:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGameAccount(v)
|
|
return nil
|
|
case user.FieldGameLv:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetGameLv(v)
|
|
return nil
|
|
case user.FieldCoin:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCoin(v)
|
|
return nil
|
|
case user.FieldCoinOpen:
|
|
v, ok := value.(bool)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCoinOpen(v)
|
|
return nil
|
|
case user.FieldCoinAt:
|
|
v, ok := value.(time.Time)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCoinAt(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown User field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *UserMutation) AddedFields() []string {
|
|
var fields []string
|
|
if m.addluck != nil {
|
|
fields = append(fields, user.FieldLuck)
|
|
}
|
|
if m.addlike != nil {
|
|
fields = append(fields, user.FieldLike)
|
|
}
|
|
if m.addlike_rank != nil {
|
|
fields = append(fields, user.FieldLikeRank)
|
|
}
|
|
if m.addfav != nil {
|
|
fields = append(fields, user.FieldFav)
|
|
}
|
|
if m.addten_su != nil {
|
|
fields = append(fields, user.FieldTenSu)
|
|
}
|
|
if m.addten_kai != nil {
|
|
fields = append(fields, user.FieldTenKai)
|
|
}
|
|
if m.addaiten != nil {
|
|
fields = append(fields, user.FieldAiten)
|
|
}
|
|
if m.addroom != nil {
|
|
fields = append(fields, user.FieldRoom)
|
|
}
|
|
if m.addmodel_attack != nil {
|
|
fields = append(fields, user.FieldModelAttack)
|
|
}
|
|
if m.addmodel_limit != nil {
|
|
fields = append(fields, user.FieldModelLimit)
|
|
}
|
|
if m.addmodel_skill != nil {
|
|
fields = append(fields, user.FieldModelSkill)
|
|
}
|
|
if m.addmodel_mode != nil {
|
|
fields = append(fields, user.FieldModelMode)
|
|
}
|
|
if m.addmodel_critical != nil {
|
|
fields = append(fields, user.FieldModelCritical)
|
|
}
|
|
if m.addmodel_critical_d != nil {
|
|
fields = append(fields, user.FieldModelCriticalD)
|
|
}
|
|
if m.addgame_lv != nil {
|
|
fields = append(fields, user.FieldGameLv)
|
|
}
|
|
if m.addcoin != nil {
|
|
fields = append(fields, user.FieldCoin)
|
|
}
|
|
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 *UserMutation) AddedField(name string) (ent.Value, bool) {
|
|
switch name {
|
|
case user.FieldLuck:
|
|
return m.AddedLuck()
|
|
case user.FieldLike:
|
|
return m.AddedLike()
|
|
case user.FieldLikeRank:
|
|
return m.AddedLikeRank()
|
|
case user.FieldFav:
|
|
return m.AddedFav()
|
|
case user.FieldTenSu:
|
|
return m.AddedTenSu()
|
|
case user.FieldTenKai:
|
|
return m.AddedTenKai()
|
|
case user.FieldAiten:
|
|
return m.AddedAiten()
|
|
case user.FieldRoom:
|
|
return m.AddedRoom()
|
|
case user.FieldModelAttack:
|
|
return m.AddedModelAttack()
|
|
case user.FieldModelLimit:
|
|
return m.AddedModelLimit()
|
|
case user.FieldModelSkill:
|
|
return m.AddedModelSkill()
|
|
case user.FieldModelMode:
|
|
return m.AddedModelMode()
|
|
case user.FieldModelCritical:
|
|
return m.AddedModelCritical()
|
|
case user.FieldModelCriticalD:
|
|
return m.AddedModelCriticalD()
|
|
case user.FieldGameLv:
|
|
return m.AddedGameLv()
|
|
case user.FieldCoin:
|
|
return m.AddedCoin()
|
|
}
|
|
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 *UserMutation) AddField(name string, value ent.Value) error {
|
|
switch name {
|
|
case user.FieldLuck:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLuck(v)
|
|
return nil
|
|
case user.FieldLike:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLike(v)
|
|
return nil
|
|
case user.FieldLikeRank:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddLikeRank(v)
|
|
return nil
|
|
case user.FieldFav:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddFav(v)
|
|
return nil
|
|
case user.FieldTenSu:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddTenSu(v)
|
|
return nil
|
|
case user.FieldTenKai:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddTenKai(v)
|
|
return nil
|
|
case user.FieldAiten:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddAiten(v)
|
|
return nil
|
|
case user.FieldRoom:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddRoom(v)
|
|
return nil
|
|
case user.FieldModelAttack:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelAttack(v)
|
|
return nil
|
|
case user.FieldModelLimit:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelLimit(v)
|
|
return nil
|
|
case user.FieldModelSkill:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelSkill(v)
|
|
return nil
|
|
case user.FieldModelMode:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelMode(v)
|
|
return nil
|
|
case user.FieldModelCritical:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelCritical(v)
|
|
return nil
|
|
case user.FieldModelCriticalD:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddModelCriticalD(v)
|
|
return nil
|
|
case user.FieldGameLv:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddGameLv(v)
|
|
return nil
|
|
case user.FieldCoin:
|
|
v, ok := value.(int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.AddCoin(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown User numeric field %s", name)
|
|
}
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
// mutation.
|
|
func (m *UserMutation) ClearedFields() []string {
|
|
var fields []string
|
|
if m.FieldCleared(user.FieldDid) {
|
|
fields = append(fields, user.FieldDid)
|
|
}
|
|
if m.FieldCleared(user.FieldMember) {
|
|
fields = append(fields, user.FieldMember)
|
|
}
|
|
if m.FieldCleared(user.FieldBook) {
|
|
fields = append(fields, user.FieldBook)
|
|
}
|
|
if m.FieldCleared(user.FieldManga) {
|
|
fields = append(fields, user.FieldManga)
|
|
}
|
|
if m.FieldCleared(user.FieldBadge) {
|
|
fields = append(fields, user.FieldBadge)
|
|
}
|
|
if m.FieldCleared(user.FieldBsky) {
|
|
fields = append(fields, user.FieldBsky)
|
|
}
|
|
if m.FieldCleared(user.FieldMastodon) {
|
|
fields = append(fields, user.FieldMastodon)
|
|
}
|
|
if m.FieldCleared(user.FieldDelete) {
|
|
fields = append(fields, user.FieldDelete)
|
|
}
|
|
if m.FieldCleared(user.FieldHandle) {
|
|
fields = append(fields, user.FieldHandle)
|
|
}
|
|
if m.FieldCleared(user.FieldToken) {
|
|
fields = append(fields, user.FieldToken)
|
|
}
|
|
if m.FieldCleared(user.FieldCreatedAt) {
|
|
fields = append(fields, user.FieldCreatedAt)
|
|
}
|
|
if m.FieldCleared(user.FieldUpdatedAt) {
|
|
fields = append(fields, user.FieldUpdatedAt)
|
|
}
|
|
if m.FieldCleared(user.FieldRaidAt) {
|
|
fields = append(fields, user.FieldRaidAt)
|
|
}
|
|
if m.FieldCleared(user.FieldServerAt) {
|
|
fields = append(fields, user.FieldServerAt)
|
|
}
|
|
if m.FieldCleared(user.FieldEggAt) {
|
|
fields = append(fields, user.FieldEggAt)
|
|
}
|
|
if m.FieldCleared(user.FieldLuck) {
|
|
fields = append(fields, user.FieldLuck)
|
|
}
|
|
if m.FieldCleared(user.FieldLuckAt) {
|
|
fields = append(fields, user.FieldLuckAt)
|
|
}
|
|
if m.FieldCleared(user.FieldLike) {
|
|
fields = append(fields, user.FieldLike)
|
|
}
|
|
if m.FieldCleared(user.FieldLikeRank) {
|
|
fields = append(fields, user.FieldLikeRank)
|
|
}
|
|
if m.FieldCleared(user.FieldLikeAt) {
|
|
fields = append(fields, user.FieldLikeAt)
|
|
}
|
|
if m.FieldCleared(user.FieldFav) {
|
|
fields = append(fields, user.FieldFav)
|
|
}
|
|
if m.FieldCleared(user.FieldTen) {
|
|
fields = append(fields, user.FieldTen)
|
|
}
|
|
if m.FieldCleared(user.FieldTenSu) {
|
|
fields = append(fields, user.FieldTenSu)
|
|
}
|
|
if m.FieldCleared(user.FieldTenKai) {
|
|
fields = append(fields, user.FieldTenKai)
|
|
}
|
|
if m.FieldCleared(user.FieldAiten) {
|
|
fields = append(fields, user.FieldAiten)
|
|
}
|
|
if m.FieldCleared(user.FieldTenCard) {
|
|
fields = append(fields, user.FieldTenCard)
|
|
}
|
|
if m.FieldCleared(user.FieldTenDelete) {
|
|
fields = append(fields, user.FieldTenDelete)
|
|
}
|
|
if m.FieldCleared(user.FieldTenPost) {
|
|
fields = append(fields, user.FieldTenPost)
|
|
}
|
|
if m.FieldCleared(user.FieldTenGet) {
|
|
fields = append(fields, user.FieldTenGet)
|
|
}
|
|
if m.FieldCleared(user.FieldTenAt) {
|
|
fields = append(fields, user.FieldTenAt)
|
|
}
|
|
if m.FieldCleared(user.FieldNext) {
|
|
fields = append(fields, user.FieldNext)
|
|
}
|
|
if m.FieldCleared(user.FieldRoom) {
|
|
fields = append(fields, user.FieldRoom)
|
|
}
|
|
if m.FieldCleared(user.FieldModel) {
|
|
fields = append(fields, user.FieldModel)
|
|
}
|
|
if m.FieldCleared(user.FieldModelAt) {
|
|
fields = append(fields, user.FieldModelAt)
|
|
}
|
|
if m.FieldCleared(user.FieldModelAttack) {
|
|
fields = append(fields, user.FieldModelAttack)
|
|
}
|
|
if m.FieldCleared(user.FieldModelLimit) {
|
|
fields = append(fields, user.FieldModelLimit)
|
|
}
|
|
if m.FieldCleared(user.FieldModelSkill) {
|
|
fields = append(fields, user.FieldModelSkill)
|
|
}
|
|
if m.FieldCleared(user.FieldModelMode) {
|
|
fields = append(fields, user.FieldModelMode)
|
|
}
|
|
if m.FieldCleared(user.FieldModelCritical) {
|
|
fields = append(fields, user.FieldModelCritical)
|
|
}
|
|
if m.FieldCleared(user.FieldModelCriticalD) {
|
|
fields = append(fields, user.FieldModelCriticalD)
|
|
}
|
|
if m.FieldCleared(user.FieldGame) {
|
|
fields = append(fields, user.FieldGame)
|
|
}
|
|
if m.FieldCleared(user.FieldGameTest) {
|
|
fields = append(fields, user.FieldGameTest)
|
|
}
|
|
if m.FieldCleared(user.FieldGameEnd) {
|
|
fields = append(fields, user.FieldGameEnd)
|
|
}
|
|
if m.FieldCleared(user.FieldGameAccount) {
|
|
fields = append(fields, user.FieldGameAccount)
|
|
}
|
|
if m.FieldCleared(user.FieldGameLv) {
|
|
fields = append(fields, user.FieldGameLv)
|
|
}
|
|
if m.FieldCleared(user.FieldCoin) {
|
|
fields = append(fields, user.FieldCoin)
|
|
}
|
|
if m.FieldCleared(user.FieldCoinOpen) {
|
|
fields = append(fields, user.FieldCoinOpen)
|
|
}
|
|
if m.FieldCleared(user.FieldCoinAt) {
|
|
fields = append(fields, user.FieldCoinAt)
|
|
}
|
|
return fields
|
|
}
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
// cleared in this mutation.
|
|
func (m *UserMutation) 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 *UserMutation) ClearField(name string) error {
|
|
switch name {
|
|
case user.FieldDid:
|
|
m.ClearDid()
|
|
return nil
|
|
case user.FieldMember:
|
|
m.ClearMember()
|
|
return nil
|
|
case user.FieldBook:
|
|
m.ClearBook()
|
|
return nil
|
|
case user.FieldManga:
|
|
m.ClearManga()
|
|
return nil
|
|
case user.FieldBadge:
|
|
m.ClearBadge()
|
|
return nil
|
|
case user.FieldBsky:
|
|
m.ClearBsky()
|
|
return nil
|
|
case user.FieldMastodon:
|
|
m.ClearMastodon()
|
|
return nil
|
|
case user.FieldDelete:
|
|
m.ClearDelete()
|
|
return nil
|
|
case user.FieldHandle:
|
|
m.ClearHandle()
|
|
return nil
|
|
case user.FieldToken:
|
|
m.ClearToken()
|
|
return nil
|
|
case user.FieldCreatedAt:
|
|
m.ClearCreatedAt()
|
|
return nil
|
|
case user.FieldUpdatedAt:
|
|
m.ClearUpdatedAt()
|
|
return nil
|
|
case user.FieldRaidAt:
|
|
m.ClearRaidAt()
|
|
return nil
|
|
case user.FieldServerAt:
|
|
m.ClearServerAt()
|
|
return nil
|
|
case user.FieldEggAt:
|
|
m.ClearEggAt()
|
|
return nil
|
|
case user.FieldLuck:
|
|
m.ClearLuck()
|
|
return nil
|
|
case user.FieldLuckAt:
|
|
m.ClearLuckAt()
|
|
return nil
|
|
case user.FieldLike:
|
|
m.ClearLike()
|
|
return nil
|
|
case user.FieldLikeRank:
|
|
m.ClearLikeRank()
|
|
return nil
|
|
case user.FieldLikeAt:
|
|
m.ClearLikeAt()
|
|
return nil
|
|
case user.FieldFav:
|
|
m.ClearFav()
|
|
return nil
|
|
case user.FieldTen:
|
|
m.ClearTen()
|
|
return nil
|
|
case user.FieldTenSu:
|
|
m.ClearTenSu()
|
|
return nil
|
|
case user.FieldTenKai:
|
|
m.ClearTenKai()
|
|
return nil
|
|
case user.FieldAiten:
|
|
m.ClearAiten()
|
|
return nil
|
|
case user.FieldTenCard:
|
|
m.ClearTenCard()
|
|
return nil
|
|
case user.FieldTenDelete:
|
|
m.ClearTenDelete()
|
|
return nil
|
|
case user.FieldTenPost:
|
|
m.ClearTenPost()
|
|
return nil
|
|
case user.FieldTenGet:
|
|
m.ClearTenGet()
|
|
return nil
|
|
case user.FieldTenAt:
|
|
m.ClearTenAt()
|
|
return nil
|
|
case user.FieldNext:
|
|
m.ClearNext()
|
|
return nil
|
|
case user.FieldRoom:
|
|
m.ClearRoom()
|
|
return nil
|
|
case user.FieldModel:
|
|
m.ClearModel()
|
|
return nil
|
|
case user.FieldModelAt:
|
|
m.ClearModelAt()
|
|
return nil
|
|
case user.FieldModelAttack:
|
|
m.ClearModelAttack()
|
|
return nil
|
|
case user.FieldModelLimit:
|
|
m.ClearModelLimit()
|
|
return nil
|
|
case user.FieldModelSkill:
|
|
m.ClearModelSkill()
|
|
return nil
|
|
case user.FieldModelMode:
|
|
m.ClearModelMode()
|
|
return nil
|
|
case user.FieldModelCritical:
|
|
m.ClearModelCritical()
|
|
return nil
|
|
case user.FieldModelCriticalD:
|
|
m.ClearModelCriticalD()
|
|
return nil
|
|
case user.FieldGame:
|
|
m.ClearGame()
|
|
return nil
|
|
case user.FieldGameTest:
|
|
m.ClearGameTest()
|
|
return nil
|
|
case user.FieldGameEnd:
|
|
m.ClearGameEnd()
|
|
return nil
|
|
case user.FieldGameAccount:
|
|
m.ClearGameAccount()
|
|
return nil
|
|
case user.FieldGameLv:
|
|
m.ClearGameLv()
|
|
return nil
|
|
case user.FieldCoin:
|
|
m.ClearCoin()
|
|
return nil
|
|
case user.FieldCoinOpen:
|
|
m.ClearCoinOpen()
|
|
return nil
|
|
case user.FieldCoinAt:
|
|
m.ClearCoinAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown User 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 *UserMutation) ResetField(name string) error {
|
|
switch name {
|
|
case user.FieldUsername:
|
|
m.ResetUsername()
|
|
return nil
|
|
case user.FieldDid:
|
|
m.ResetDid()
|
|
return nil
|
|
case user.FieldMember:
|
|
m.ResetMember()
|
|
return nil
|
|
case user.FieldBook:
|
|
m.ResetBook()
|
|
return nil
|
|
case user.FieldManga:
|
|
m.ResetManga()
|
|
return nil
|
|
case user.FieldBadge:
|
|
m.ResetBadge()
|
|
return nil
|
|
case user.FieldBsky:
|
|
m.ResetBsky()
|
|
return nil
|
|
case user.FieldMastodon:
|
|
m.ResetMastodon()
|
|
return nil
|
|
case user.FieldDelete:
|
|
m.ResetDelete()
|
|
return nil
|
|
case user.FieldHandle:
|
|
m.ResetHandle()
|
|
return nil
|
|
case user.FieldToken:
|
|
m.ResetToken()
|
|
return nil
|
|
case user.FieldPassword:
|
|
m.ResetPassword()
|
|
return nil
|
|
case user.FieldCreatedAt:
|
|
m.ResetCreatedAt()
|
|
return nil
|
|
case user.FieldUpdatedAt:
|
|
m.ResetUpdatedAt()
|
|
return nil
|
|
case user.FieldRaidAt:
|
|
m.ResetRaidAt()
|
|
return nil
|
|
case user.FieldServerAt:
|
|
m.ResetServerAt()
|
|
return nil
|
|
case user.FieldEggAt:
|
|
m.ResetEggAt()
|
|
return nil
|
|
case user.FieldLuck:
|
|
m.ResetLuck()
|
|
return nil
|
|
case user.FieldLuckAt:
|
|
m.ResetLuckAt()
|
|
return nil
|
|
case user.FieldLike:
|
|
m.ResetLike()
|
|
return nil
|
|
case user.FieldLikeRank:
|
|
m.ResetLikeRank()
|
|
return nil
|
|
case user.FieldLikeAt:
|
|
m.ResetLikeAt()
|
|
return nil
|
|
case user.FieldFav:
|
|
m.ResetFav()
|
|
return nil
|
|
case user.FieldTen:
|
|
m.ResetTen()
|
|
return nil
|
|
case user.FieldTenSu:
|
|
m.ResetTenSu()
|
|
return nil
|
|
case user.FieldTenKai:
|
|
m.ResetTenKai()
|
|
return nil
|
|
case user.FieldAiten:
|
|
m.ResetAiten()
|
|
return nil
|
|
case user.FieldTenCard:
|
|
m.ResetTenCard()
|
|
return nil
|
|
case user.FieldTenDelete:
|
|
m.ResetTenDelete()
|
|
return nil
|
|
case user.FieldTenPost:
|
|
m.ResetTenPost()
|
|
return nil
|
|
case user.FieldTenGet:
|
|
m.ResetTenGet()
|
|
return nil
|
|
case user.FieldTenAt:
|
|
m.ResetTenAt()
|
|
return nil
|
|
case user.FieldNext:
|
|
m.ResetNext()
|
|
return nil
|
|
case user.FieldRoom:
|
|
m.ResetRoom()
|
|
return nil
|
|
case user.FieldModel:
|
|
m.ResetModel()
|
|
return nil
|
|
case user.FieldModelAt:
|
|
m.ResetModelAt()
|
|
return nil
|
|
case user.FieldModelAttack:
|
|
m.ResetModelAttack()
|
|
return nil
|
|
case user.FieldModelLimit:
|
|
m.ResetModelLimit()
|
|
return nil
|
|
case user.FieldModelSkill:
|
|
m.ResetModelSkill()
|
|
return nil
|
|
case user.FieldModelMode:
|
|
m.ResetModelMode()
|
|
return nil
|
|
case user.FieldModelCritical:
|
|
m.ResetModelCritical()
|
|
return nil
|
|
case user.FieldModelCriticalD:
|
|
m.ResetModelCriticalD()
|
|
return nil
|
|
case user.FieldGame:
|
|
m.ResetGame()
|
|
return nil
|
|
case user.FieldGameTest:
|
|
m.ResetGameTest()
|
|
return nil
|
|
case user.FieldGameEnd:
|
|
m.ResetGameEnd()
|
|
return nil
|
|
case user.FieldGameAccount:
|
|
m.ResetGameAccount()
|
|
return nil
|
|
case user.FieldGameLv:
|
|
m.ResetGameLv()
|
|
return nil
|
|
case user.FieldCoin:
|
|
m.ResetCoin()
|
|
return nil
|
|
case user.FieldCoinOpen:
|
|
m.ResetCoinOpen()
|
|
return nil
|
|
case user.FieldCoinAt:
|
|
m.ResetCoinAt()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown User field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *UserMutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.card != nil {
|
|
edges = append(edges, user.EdgeCard)
|
|
}
|
|
if m.ue != nil {
|
|
edges = append(edges, user.EdgeUe)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
// name in this mutation.
|
|
func (m *UserMutation) AddedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case user.EdgeCard:
|
|
ids := make([]ent.Value, 0, len(m.card))
|
|
for id := range m.card {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
case user.EdgeUe:
|
|
ids := make([]ent.Value, 0, len(m.ue))
|
|
for id := range m.ue {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *UserMutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.removedcard != nil {
|
|
edges = append(edges, user.EdgeCard)
|
|
}
|
|
if m.removedue != nil {
|
|
edges = append(edges, user.EdgeUe)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
// the given name in this mutation.
|
|
func (m *UserMutation) RemovedIDs(name string) []ent.Value {
|
|
switch name {
|
|
case user.EdgeCard:
|
|
ids := make([]ent.Value, 0, len(m.removedcard))
|
|
for id := range m.removedcard {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
case user.EdgeUe:
|
|
ids := make([]ent.Value, 0, len(m.removedue))
|
|
for id := range m.removedue {
|
|
ids = append(ids, id)
|
|
}
|
|
return ids
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
func (m *UserMutation) ClearedEdges() []string {
|
|
edges := make([]string, 0, 2)
|
|
if m.clearedcard {
|
|
edges = append(edges, user.EdgeCard)
|
|
}
|
|
if m.clearedue {
|
|
edges = append(edges, user.EdgeUe)
|
|
}
|
|
return edges
|
|
}
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
// was cleared in this mutation.
|
|
func (m *UserMutation) EdgeCleared(name string) bool {
|
|
switch name {
|
|
case user.EdgeCard:
|
|
return m.clearedcard
|
|
case user.EdgeUe:
|
|
return m.clearedue
|
|
}
|
|
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 *UserMutation) ClearEdge(name string) error {
|
|
switch name {
|
|
}
|
|
return fmt.Errorf("unknown User 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 *UserMutation) ResetEdge(name string) error {
|
|
switch name {
|
|
case user.EdgeCard:
|
|
m.ResetCard()
|
|
return nil
|
|
case user.EdgeUe:
|
|
m.ResetUe()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown User edge %s", name)
|
|
}
|