// Code generated by ent, DO NOT EDIT. package ent import ( "api/ent/card" "api/ent/group" "api/ent/ma" "api/ent/predicate" "api/ent/sev" "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" TypeMa = "Ma" TypeSev = "Sev" 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) } // MaMutation represents an operation that mutates the Ma nodes in the graph. type MaMutation struct { config op Op typ string id *int password *string token *string _limit *bool count *int addcount *int handle *string text *string did *string avatar *string cid *string uri *string cid_root *string uri_root *string root *string rkey *string bsky_url *string comment *string blog *string blog_url *string domain *string host *string feed *string updated_at *time.Time created_at *time.Time clearedFields map[string]struct{} owner *int clearedowner bool done bool oldValue func(context.Context) (*Ma, error) predicates []predicate.Ma } var _ ent.Mutation = (*MaMutation)(nil) // maOption allows management of the mutation configuration using functional options. type maOption func(*MaMutation) // newMaMutation creates new mutation for the Ma entity. func newMaMutation(c config, op Op, opts ...maOption) *MaMutation { m := &MaMutation{ config: c, op: op, typ: TypeMa, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withMaID sets the ID field of the mutation. func withMaID(id int) maOption { return func(m *MaMutation) { var ( err error once sync.Once value *Ma ) m.oldValue = func(ctx context.Context) (*Ma, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Ma.Get(ctx, id) } }) return value, err } m.id = &id } } // withMa sets the old Ma of the mutation. func withMa(node *Ma) maOption { return func(m *MaMutation) { m.oldValue = func(context.Context) (*Ma, 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 MaMutation) 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 MaMutation) 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 *MaMutation) 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 *MaMutation) 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().Ma.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 *MaMutation) SetPassword(s string) { m.password = &s } // Password returns the value of the "password" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ResetPassword() { m.password = nil } // SetToken sets the "token" field. func (m *MaMutation) SetToken(s string) { m.token = &s } // Token returns the value of the "token" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ClearToken() { m.token = nil m.clearedFields[ma.FieldToken] = struct{}{} } // TokenCleared returns if the "token" field was cleared in this mutation. func (m *MaMutation) TokenCleared() bool { _, ok := m.clearedFields[ma.FieldToken] return ok } // ResetToken resets all changes to the "token" field. func (m *MaMutation) ResetToken() { m.token = nil delete(m.clearedFields, ma.FieldToken) } // SetLimit sets the "limit" field. func (m *MaMutation) SetLimit(b bool) { m._limit = &b } // Limit returns the value of the "limit" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ClearLimit() { m._limit = nil m.clearedFields[ma.FieldLimit] = struct{}{} } // LimitCleared returns if the "limit" field was cleared in this mutation. func (m *MaMutation) LimitCleared() bool { _, ok := m.clearedFields[ma.FieldLimit] return ok } // ResetLimit resets all changes to the "limit" field. func (m *MaMutation) ResetLimit() { m._limit = nil delete(m.clearedFields, ma.FieldLimit) } // SetCount sets the "count" field. func (m *MaMutation) SetCount(i int) { m.count = &i m.addcount = nil } // Count returns the value of the "count" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) 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 *MaMutation) 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 *MaMutation) ClearCount() { m.count = nil m.addcount = nil m.clearedFields[ma.FieldCount] = struct{}{} } // CountCleared returns if the "count" field was cleared in this mutation. func (m *MaMutation) CountCleared() bool { _, ok := m.clearedFields[ma.FieldCount] return ok } // ResetCount resets all changes to the "count" field. func (m *MaMutation) ResetCount() { m.count = nil m.addcount = nil delete(m.clearedFields, ma.FieldCount) } // SetHandle sets the "handle" field. func (m *MaMutation) SetHandle(s string) { m.handle = &s } // Handle returns the value of the "handle" field in the mutation. func (m *MaMutation) Handle() (r string, exists bool) { v := m.handle if v == nil { return } return *v, true } // OldHandle returns the old "handle" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldHandle(ctx context.Context) (v string, 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 *MaMutation) ClearHandle() { m.handle = nil m.clearedFields[ma.FieldHandle] = struct{}{} } // HandleCleared returns if the "handle" field was cleared in this mutation. func (m *MaMutation) HandleCleared() bool { _, ok := m.clearedFields[ma.FieldHandle] return ok } // ResetHandle resets all changes to the "handle" field. func (m *MaMutation) ResetHandle() { m.handle = nil delete(m.clearedFields, ma.FieldHandle) } // SetText sets the "text" field. func (m *MaMutation) SetText(s string) { m.text = &s } // Text returns the value of the "text" field in the mutation. func (m *MaMutation) Text() (r string, exists bool) { v := m.text if v == nil { return } return *v, true } // OldText returns the old "text" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldText(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldText is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldText requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldText: %w", err) } return oldValue.Text, nil } // ClearText clears the value of the "text" field. func (m *MaMutation) ClearText() { m.text = nil m.clearedFields[ma.FieldText] = struct{}{} } // TextCleared returns if the "text" field was cleared in this mutation. func (m *MaMutation) TextCleared() bool { _, ok := m.clearedFields[ma.FieldText] return ok } // ResetText resets all changes to the "text" field. func (m *MaMutation) ResetText() { m.text = nil delete(m.clearedFields, ma.FieldText) } // SetDid sets the "did" field. func (m *MaMutation) SetDid(s string) { m.did = &s } // Did returns the value of the "did" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ClearDid() { m.did = nil m.clearedFields[ma.FieldDid] = struct{}{} } // DidCleared returns if the "did" field was cleared in this mutation. func (m *MaMutation) DidCleared() bool { _, ok := m.clearedFields[ma.FieldDid] return ok } // ResetDid resets all changes to the "did" field. func (m *MaMutation) ResetDid() { m.did = nil delete(m.clearedFields, ma.FieldDid) } // SetAvatar sets the "avatar" field. func (m *MaMutation) SetAvatar(s string) { m.avatar = &s } // Avatar returns the value of the "avatar" field in the mutation. func (m *MaMutation) Avatar() (r string, exists bool) { v := m.avatar if v == nil { return } return *v, true } // OldAvatar returns the old "avatar" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldAvatar(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldAvatar is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldAvatar requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldAvatar: %w", err) } return oldValue.Avatar, nil } // ClearAvatar clears the value of the "avatar" field. func (m *MaMutation) ClearAvatar() { m.avatar = nil m.clearedFields[ma.FieldAvatar] = struct{}{} } // AvatarCleared returns if the "avatar" field was cleared in this mutation. func (m *MaMutation) AvatarCleared() bool { _, ok := m.clearedFields[ma.FieldAvatar] return ok } // ResetAvatar resets all changes to the "avatar" field. func (m *MaMutation) ResetAvatar() { m.avatar = nil delete(m.clearedFields, ma.FieldAvatar) } // SetCid sets the "cid" field. func (m *MaMutation) SetCid(s string) { m.cid = &s } // Cid returns the value of the "cid" field in the mutation. func (m *MaMutation) Cid() (r string, exists bool) { v := m.cid if v == nil { return } return *v, true } // OldCid returns the old "cid" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldCid(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCid is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldCid requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldCid: %w", err) } return oldValue.Cid, nil } // ClearCid clears the value of the "cid" field. func (m *MaMutation) ClearCid() { m.cid = nil m.clearedFields[ma.FieldCid] = struct{}{} } // CidCleared returns if the "cid" field was cleared in this mutation. func (m *MaMutation) CidCleared() bool { _, ok := m.clearedFields[ma.FieldCid] return ok } // ResetCid resets all changes to the "cid" field. func (m *MaMutation) ResetCid() { m.cid = nil delete(m.clearedFields, ma.FieldCid) } // SetURI sets the "uri" field. func (m *MaMutation) SetURI(s string) { m.uri = &s } // URI returns the value of the "uri" field in the mutation. func (m *MaMutation) URI() (r string, exists bool) { v := m.uri if v == nil { return } return *v, true } // OldURI returns the old "uri" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldURI(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldURI is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldURI requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldURI: %w", err) } return oldValue.URI, nil } // ClearURI clears the value of the "uri" field. func (m *MaMutation) ClearURI() { m.uri = nil m.clearedFields[ma.FieldURI] = struct{}{} } // URICleared returns if the "uri" field was cleared in this mutation. func (m *MaMutation) URICleared() bool { _, ok := m.clearedFields[ma.FieldURI] return ok } // ResetURI resets all changes to the "uri" field. func (m *MaMutation) ResetURI() { m.uri = nil delete(m.clearedFields, ma.FieldURI) } // SetCidRoot sets the "cid_root" field. func (m *MaMutation) SetCidRoot(s string) { m.cid_root = &s } // CidRoot returns the value of the "cid_root" field in the mutation. func (m *MaMutation) CidRoot() (r string, exists bool) { v := m.cid_root if v == nil { return } return *v, true } // OldCidRoot returns the old "cid_root" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldCidRoot(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCidRoot is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldCidRoot requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldCidRoot: %w", err) } return oldValue.CidRoot, nil } // ClearCidRoot clears the value of the "cid_root" field. func (m *MaMutation) ClearCidRoot() { m.cid_root = nil m.clearedFields[ma.FieldCidRoot] = struct{}{} } // CidRootCleared returns if the "cid_root" field was cleared in this mutation. func (m *MaMutation) CidRootCleared() bool { _, ok := m.clearedFields[ma.FieldCidRoot] return ok } // ResetCidRoot resets all changes to the "cid_root" field. func (m *MaMutation) ResetCidRoot() { m.cid_root = nil delete(m.clearedFields, ma.FieldCidRoot) } // SetURIRoot sets the "uri_root" field. func (m *MaMutation) SetURIRoot(s string) { m.uri_root = &s } // URIRoot returns the value of the "uri_root" field in the mutation. func (m *MaMutation) URIRoot() (r string, exists bool) { v := m.uri_root if v == nil { return } return *v, true } // OldURIRoot returns the old "uri_root" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldURIRoot(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldURIRoot is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldURIRoot requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldURIRoot: %w", err) } return oldValue.URIRoot, nil } // ClearURIRoot clears the value of the "uri_root" field. func (m *MaMutation) ClearURIRoot() { m.uri_root = nil m.clearedFields[ma.FieldURIRoot] = struct{}{} } // URIRootCleared returns if the "uri_root" field was cleared in this mutation. func (m *MaMutation) URIRootCleared() bool { _, ok := m.clearedFields[ma.FieldURIRoot] return ok } // ResetURIRoot resets all changes to the "uri_root" field. func (m *MaMutation) ResetURIRoot() { m.uri_root = nil delete(m.clearedFields, ma.FieldURIRoot) } // SetRoot sets the "root" field. func (m *MaMutation) SetRoot(s string) { m.root = &s } // Root returns the value of the "root" field in the mutation. func (m *MaMutation) Root() (r string, exists bool) { v := m.root if v == nil { return } return *v, true } // OldRoot returns the old "root" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldRoot(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldRoot is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldRoot requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldRoot: %w", err) } return oldValue.Root, nil } // ClearRoot clears the value of the "root" field. func (m *MaMutation) ClearRoot() { m.root = nil m.clearedFields[ma.FieldRoot] = struct{}{} } // RootCleared returns if the "root" field was cleared in this mutation. func (m *MaMutation) RootCleared() bool { _, ok := m.clearedFields[ma.FieldRoot] return ok } // ResetRoot resets all changes to the "root" field. func (m *MaMutation) ResetRoot() { m.root = nil delete(m.clearedFields, ma.FieldRoot) } // SetRkey sets the "rkey" field. func (m *MaMutation) SetRkey(s string) { m.rkey = &s } // Rkey returns the value of the "rkey" field in the mutation. func (m *MaMutation) Rkey() (r string, exists bool) { v := m.rkey if v == nil { return } return *v, true } // OldRkey returns the old "rkey" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldRkey(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldRkey is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldRkey requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldRkey: %w", err) } return oldValue.Rkey, nil } // ClearRkey clears the value of the "rkey" field. func (m *MaMutation) ClearRkey() { m.rkey = nil m.clearedFields[ma.FieldRkey] = struct{}{} } // RkeyCleared returns if the "rkey" field was cleared in this mutation. func (m *MaMutation) RkeyCleared() bool { _, ok := m.clearedFields[ma.FieldRkey] return ok } // ResetRkey resets all changes to the "rkey" field. func (m *MaMutation) ResetRkey() { m.rkey = nil delete(m.clearedFields, ma.FieldRkey) } // SetBskyURL sets the "bsky_url" field. func (m *MaMutation) SetBskyURL(s string) { m.bsky_url = &s } // BskyURL returns the value of the "bsky_url" field in the mutation. func (m *MaMutation) BskyURL() (r string, exists bool) { v := m.bsky_url if v == nil { return } return *v, true } // OldBskyURL returns the old "bsky_url" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldBskyURL(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldBskyURL is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldBskyURL requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldBskyURL: %w", err) } return oldValue.BskyURL, nil } // ClearBskyURL clears the value of the "bsky_url" field. func (m *MaMutation) ClearBskyURL() { m.bsky_url = nil m.clearedFields[ma.FieldBskyURL] = struct{}{} } // BskyURLCleared returns if the "bsky_url" field was cleared in this mutation. func (m *MaMutation) BskyURLCleared() bool { _, ok := m.clearedFields[ma.FieldBskyURL] return ok } // ResetBskyURL resets all changes to the "bsky_url" field. func (m *MaMutation) ResetBskyURL() { m.bsky_url = nil delete(m.clearedFields, ma.FieldBskyURL) } // SetComment sets the "comment" field. func (m *MaMutation) SetComment(s string) { m.comment = &s } // Comment returns the value of the "comment" field in the mutation. func (m *MaMutation) Comment() (r string, exists bool) { v := m.comment if v == nil { return } return *v, true } // OldComment returns the old "comment" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldComment(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldComment is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldComment requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldComment: %w", err) } return oldValue.Comment, nil } // ClearComment clears the value of the "comment" field. func (m *MaMutation) ClearComment() { m.comment = nil m.clearedFields[ma.FieldComment] = struct{}{} } // CommentCleared returns if the "comment" field was cleared in this mutation. func (m *MaMutation) CommentCleared() bool { _, ok := m.clearedFields[ma.FieldComment] return ok } // ResetComment resets all changes to the "comment" field. func (m *MaMutation) ResetComment() { m.comment = nil delete(m.clearedFields, ma.FieldComment) } // SetBlog sets the "blog" field. func (m *MaMutation) SetBlog(s string) { m.blog = &s } // Blog returns the value of the "blog" field in the mutation. func (m *MaMutation) Blog() (r string, exists bool) { v := m.blog if v == nil { return } return *v, true } // OldBlog returns the old "blog" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldBlog(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldBlog is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldBlog requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldBlog: %w", err) } return oldValue.Blog, nil } // ClearBlog clears the value of the "blog" field. func (m *MaMutation) ClearBlog() { m.blog = nil m.clearedFields[ma.FieldBlog] = struct{}{} } // BlogCleared returns if the "blog" field was cleared in this mutation. func (m *MaMutation) BlogCleared() bool { _, ok := m.clearedFields[ma.FieldBlog] return ok } // ResetBlog resets all changes to the "blog" field. func (m *MaMutation) ResetBlog() { m.blog = nil delete(m.clearedFields, ma.FieldBlog) } // SetBlogURL sets the "blog_url" field. func (m *MaMutation) SetBlogURL(s string) { m.blog_url = &s } // BlogURL returns the value of the "blog_url" field in the mutation. func (m *MaMutation) BlogURL() (r string, exists bool) { v := m.blog_url if v == nil { return } return *v, true } // OldBlogURL returns the old "blog_url" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldBlogURL(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldBlogURL is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldBlogURL requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldBlogURL: %w", err) } return oldValue.BlogURL, nil } // ClearBlogURL clears the value of the "blog_url" field. func (m *MaMutation) ClearBlogURL() { m.blog_url = nil m.clearedFields[ma.FieldBlogURL] = struct{}{} } // BlogURLCleared returns if the "blog_url" field was cleared in this mutation. func (m *MaMutation) BlogURLCleared() bool { _, ok := m.clearedFields[ma.FieldBlogURL] return ok } // ResetBlogURL resets all changes to the "blog_url" field. func (m *MaMutation) ResetBlogURL() { m.blog_url = nil delete(m.clearedFields, ma.FieldBlogURL) } // SetDomain sets the "domain" field. func (m *MaMutation) SetDomain(s string) { m.domain = &s } // Domain returns the value of the "domain" field in the mutation. func (m *MaMutation) Domain() (r string, exists bool) { v := m.domain if v == nil { return } return *v, true } // OldDomain returns the old "domain" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldDomain(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldDomain is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldDomain requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldDomain: %w", err) } return oldValue.Domain, nil } // ClearDomain clears the value of the "domain" field. func (m *MaMutation) ClearDomain() { m.domain = nil m.clearedFields[ma.FieldDomain] = struct{}{} } // DomainCleared returns if the "domain" field was cleared in this mutation. func (m *MaMutation) DomainCleared() bool { _, ok := m.clearedFields[ma.FieldDomain] return ok } // ResetDomain resets all changes to the "domain" field. func (m *MaMutation) ResetDomain() { m.domain = nil delete(m.clearedFields, ma.FieldDomain) } // SetHost sets the "host" field. func (m *MaMutation) SetHost(s string) { m.host = &s } // Host returns the value of the "host" field in the mutation. func (m *MaMutation) Host() (r string, exists bool) { v := m.host if v == nil { return } return *v, true } // OldHost returns the old "host" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldHost(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldHost is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldHost requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldHost: %w", err) } return oldValue.Host, nil } // ClearHost clears the value of the "host" field. func (m *MaMutation) ClearHost() { m.host = nil m.clearedFields[ma.FieldHost] = struct{}{} } // HostCleared returns if the "host" field was cleared in this mutation. func (m *MaMutation) HostCleared() bool { _, ok := m.clearedFields[ma.FieldHost] return ok } // ResetHost resets all changes to the "host" field. func (m *MaMutation) ResetHost() { m.host = nil delete(m.clearedFields, ma.FieldHost) } // SetFeed sets the "feed" field. func (m *MaMutation) SetFeed(s string) { m.feed = &s } // Feed returns the value of the "feed" field in the mutation. func (m *MaMutation) Feed() (r string, exists bool) { v := m.feed if v == nil { return } return *v, true } // OldFeed returns the old "feed" field's value of the Ma entity. // If the Ma 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 *MaMutation) OldFeed(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldFeed is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldFeed requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldFeed: %w", err) } return oldValue.Feed, nil } // ClearFeed clears the value of the "feed" field. func (m *MaMutation) ClearFeed() { m.feed = nil m.clearedFields[ma.FieldFeed] = struct{}{} } // FeedCleared returns if the "feed" field was cleared in this mutation. func (m *MaMutation) FeedCleared() bool { _, ok := m.clearedFields[ma.FieldFeed] return ok } // ResetFeed resets all changes to the "feed" field. func (m *MaMutation) ResetFeed() { m.feed = nil delete(m.clearedFields, ma.FieldFeed) } // SetUpdatedAt sets the "updated_at" field. func (m *MaMutation) SetUpdatedAt(t time.Time) { m.updated_at = &t } // UpdatedAt returns the value of the "updated_at" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ClearUpdatedAt() { m.updated_at = nil m.clearedFields[ma.FieldUpdatedAt] = struct{}{} } // UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation. func (m *MaMutation) UpdatedAtCleared() bool { _, ok := m.clearedFields[ma.FieldUpdatedAt] return ok } // ResetUpdatedAt resets all changes to the "updated_at" field. func (m *MaMutation) ResetUpdatedAt() { m.updated_at = nil delete(m.clearedFields, ma.FieldUpdatedAt) } // SetCreatedAt sets the "created_at" field. func (m *MaMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. func (m *MaMutation) 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 Ma entity. // If the Ma 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 *MaMutation) 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 *MaMutation) ClearCreatedAt() { m.created_at = nil m.clearedFields[ma.FieldCreatedAt] = struct{}{} } // CreatedAtCleared returns if the "created_at" field was cleared in this mutation. func (m *MaMutation) CreatedAtCleared() bool { _, ok := m.clearedFields[ma.FieldCreatedAt] return ok } // ResetCreatedAt resets all changes to the "created_at" field. func (m *MaMutation) ResetCreatedAt() { m.created_at = nil delete(m.clearedFields, ma.FieldCreatedAt) } // SetOwnerID sets the "owner" edge to the User entity by id. func (m *MaMutation) SetOwnerID(id int) { m.owner = &id } // ClearOwner clears the "owner" edge to the User entity. func (m *MaMutation) ClearOwner() { m.clearedowner = true } // OwnerCleared reports if the "owner" edge to the User entity was cleared. func (m *MaMutation) OwnerCleared() bool { return m.clearedowner } // OwnerID returns the "owner" edge ID in the mutation. func (m *MaMutation) 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 *MaMutation) OwnerIDs() (ids []int) { if id := m.owner; id != nil { ids = append(ids, *id) } return } // ResetOwner resets all changes to the "owner" edge. func (m *MaMutation) ResetOwner() { m.owner = nil m.clearedowner = false } // Where appends a list predicates to the MaMutation builder. func (m *MaMutation) Where(ps ...predicate.Ma) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the MaMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *MaMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Ma, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *MaMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *MaMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Ma). func (m *MaMutation) 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 *MaMutation) Fields() []string { fields := make([]string, 0, 23) if m.password != nil { fields = append(fields, ma.FieldPassword) } if m.token != nil { fields = append(fields, ma.FieldToken) } if m._limit != nil { fields = append(fields, ma.FieldLimit) } if m.count != nil { fields = append(fields, ma.FieldCount) } if m.handle != nil { fields = append(fields, ma.FieldHandle) } if m.text != nil { fields = append(fields, ma.FieldText) } if m.did != nil { fields = append(fields, ma.FieldDid) } if m.avatar != nil { fields = append(fields, ma.FieldAvatar) } if m.cid != nil { fields = append(fields, ma.FieldCid) } if m.uri != nil { fields = append(fields, ma.FieldURI) } if m.cid_root != nil { fields = append(fields, ma.FieldCidRoot) } if m.uri_root != nil { fields = append(fields, ma.FieldURIRoot) } if m.root != nil { fields = append(fields, ma.FieldRoot) } if m.rkey != nil { fields = append(fields, ma.FieldRkey) } if m.bsky_url != nil { fields = append(fields, ma.FieldBskyURL) } if m.comment != nil { fields = append(fields, ma.FieldComment) } if m.blog != nil { fields = append(fields, ma.FieldBlog) } if m.blog_url != nil { fields = append(fields, ma.FieldBlogURL) } if m.domain != nil { fields = append(fields, ma.FieldDomain) } if m.host != nil { fields = append(fields, ma.FieldHost) } if m.feed != nil { fields = append(fields, ma.FieldFeed) } if m.updated_at != nil { fields = append(fields, ma.FieldUpdatedAt) } if m.created_at != nil { fields = append(fields, ma.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 *MaMutation) Field(name string) (ent.Value, bool) { switch name { case ma.FieldPassword: return m.Password() case ma.FieldToken: return m.Token() case ma.FieldLimit: return m.Limit() case ma.FieldCount: return m.Count() case ma.FieldHandle: return m.Handle() case ma.FieldText: return m.Text() case ma.FieldDid: return m.Did() case ma.FieldAvatar: return m.Avatar() case ma.FieldCid: return m.Cid() case ma.FieldURI: return m.URI() case ma.FieldCidRoot: return m.CidRoot() case ma.FieldURIRoot: return m.URIRoot() case ma.FieldRoot: return m.Root() case ma.FieldRkey: return m.Rkey() case ma.FieldBskyURL: return m.BskyURL() case ma.FieldComment: return m.Comment() case ma.FieldBlog: return m.Blog() case ma.FieldBlogURL: return m.BlogURL() case ma.FieldDomain: return m.Domain() case ma.FieldHost: return m.Host() case ma.FieldFeed: return m.Feed() case ma.FieldUpdatedAt: return m.UpdatedAt() case ma.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 *MaMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case ma.FieldPassword: return m.OldPassword(ctx) case ma.FieldToken: return m.OldToken(ctx) case ma.FieldLimit: return m.OldLimit(ctx) case ma.FieldCount: return m.OldCount(ctx) case ma.FieldHandle: return m.OldHandle(ctx) case ma.FieldText: return m.OldText(ctx) case ma.FieldDid: return m.OldDid(ctx) case ma.FieldAvatar: return m.OldAvatar(ctx) case ma.FieldCid: return m.OldCid(ctx) case ma.FieldURI: return m.OldURI(ctx) case ma.FieldCidRoot: return m.OldCidRoot(ctx) case ma.FieldURIRoot: return m.OldURIRoot(ctx) case ma.FieldRoot: return m.OldRoot(ctx) case ma.FieldRkey: return m.OldRkey(ctx) case ma.FieldBskyURL: return m.OldBskyURL(ctx) case ma.FieldComment: return m.OldComment(ctx) case ma.FieldBlog: return m.OldBlog(ctx) case ma.FieldBlogURL: return m.OldBlogURL(ctx) case ma.FieldDomain: return m.OldDomain(ctx) case ma.FieldHost: return m.OldHost(ctx) case ma.FieldFeed: return m.OldFeed(ctx) case ma.FieldUpdatedAt: return m.OldUpdatedAt(ctx) case ma.FieldCreatedAt: return m.OldCreatedAt(ctx) } return nil, fmt.Errorf("unknown Ma 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 *MaMutation) SetField(name string, value ent.Value) error { switch name { case ma.FieldPassword: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPassword(v) return nil case ma.FieldToken: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetToken(v) return nil case ma.FieldLimit: v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLimit(v) return nil case ma.FieldCount: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCount(v) return nil case ma.FieldHandle: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetHandle(v) return nil case ma.FieldText: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetText(v) return nil case ma.FieldDid: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetDid(v) return nil case ma.FieldAvatar: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetAvatar(v) return nil case ma.FieldCid: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCid(v) return nil case ma.FieldURI: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetURI(v) return nil case ma.FieldCidRoot: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCidRoot(v) return nil case ma.FieldURIRoot: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetURIRoot(v) return nil case ma.FieldRoot: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetRoot(v) return nil case ma.FieldRkey: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetRkey(v) return nil case ma.FieldBskyURL: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetBskyURL(v) return nil case ma.FieldComment: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetComment(v) return nil case ma.FieldBlog: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetBlog(v) return nil case ma.FieldBlogURL: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetBlogURL(v) return nil case ma.FieldDomain: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetDomain(v) return nil case ma.FieldHost: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetHost(v) return nil case ma.FieldFeed: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetFeed(v) return nil case ma.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 ma.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 Ma field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *MaMutation) AddedFields() []string { var fields []string if m.addcount != nil { fields = append(fields, ma.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 *MaMutation) AddedField(name string) (ent.Value, bool) { switch name { case ma.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 *MaMutation) AddField(name string, value ent.Value) error { switch name { case ma.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 Ma numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *MaMutation) ClearedFields() []string { var fields []string if m.FieldCleared(ma.FieldToken) { fields = append(fields, ma.FieldToken) } if m.FieldCleared(ma.FieldLimit) { fields = append(fields, ma.FieldLimit) } if m.FieldCleared(ma.FieldCount) { fields = append(fields, ma.FieldCount) } if m.FieldCleared(ma.FieldHandle) { fields = append(fields, ma.FieldHandle) } if m.FieldCleared(ma.FieldText) { fields = append(fields, ma.FieldText) } if m.FieldCleared(ma.FieldDid) { fields = append(fields, ma.FieldDid) } if m.FieldCleared(ma.FieldAvatar) { fields = append(fields, ma.FieldAvatar) } if m.FieldCleared(ma.FieldCid) { fields = append(fields, ma.FieldCid) } if m.FieldCleared(ma.FieldURI) { fields = append(fields, ma.FieldURI) } if m.FieldCleared(ma.FieldCidRoot) { fields = append(fields, ma.FieldCidRoot) } if m.FieldCleared(ma.FieldURIRoot) { fields = append(fields, ma.FieldURIRoot) } if m.FieldCleared(ma.FieldRoot) { fields = append(fields, ma.FieldRoot) } if m.FieldCleared(ma.FieldRkey) { fields = append(fields, ma.FieldRkey) } if m.FieldCleared(ma.FieldBskyURL) { fields = append(fields, ma.FieldBskyURL) } if m.FieldCleared(ma.FieldComment) { fields = append(fields, ma.FieldComment) } if m.FieldCleared(ma.FieldBlog) { fields = append(fields, ma.FieldBlog) } if m.FieldCleared(ma.FieldBlogURL) { fields = append(fields, ma.FieldBlogURL) } if m.FieldCleared(ma.FieldDomain) { fields = append(fields, ma.FieldDomain) } if m.FieldCleared(ma.FieldHost) { fields = append(fields, ma.FieldHost) } if m.FieldCleared(ma.FieldFeed) { fields = append(fields, ma.FieldFeed) } if m.FieldCleared(ma.FieldUpdatedAt) { fields = append(fields, ma.FieldUpdatedAt) } if m.FieldCleared(ma.FieldCreatedAt) { fields = append(fields, ma.FieldCreatedAt) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *MaMutation) 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 *MaMutation) ClearField(name string) error { switch name { case ma.FieldToken: m.ClearToken() return nil case ma.FieldLimit: m.ClearLimit() return nil case ma.FieldCount: m.ClearCount() return nil case ma.FieldHandle: m.ClearHandle() return nil case ma.FieldText: m.ClearText() return nil case ma.FieldDid: m.ClearDid() return nil case ma.FieldAvatar: m.ClearAvatar() return nil case ma.FieldCid: m.ClearCid() return nil case ma.FieldURI: m.ClearURI() return nil case ma.FieldCidRoot: m.ClearCidRoot() return nil case ma.FieldURIRoot: m.ClearURIRoot() return nil case ma.FieldRoot: m.ClearRoot() return nil case ma.FieldRkey: m.ClearRkey() return nil case ma.FieldBskyURL: m.ClearBskyURL() return nil case ma.FieldComment: m.ClearComment() return nil case ma.FieldBlog: m.ClearBlog() return nil case ma.FieldBlogURL: m.ClearBlogURL() return nil case ma.FieldDomain: m.ClearDomain() return nil case ma.FieldHost: m.ClearHost() return nil case ma.FieldFeed: m.ClearFeed() return nil case ma.FieldUpdatedAt: m.ClearUpdatedAt() return nil case ma.FieldCreatedAt: m.ClearCreatedAt() return nil } return fmt.Errorf("unknown Ma 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 *MaMutation) ResetField(name string) error { switch name { case ma.FieldPassword: m.ResetPassword() return nil case ma.FieldToken: m.ResetToken() return nil case ma.FieldLimit: m.ResetLimit() return nil case ma.FieldCount: m.ResetCount() return nil case ma.FieldHandle: m.ResetHandle() return nil case ma.FieldText: m.ResetText() return nil case ma.FieldDid: m.ResetDid() return nil case ma.FieldAvatar: m.ResetAvatar() return nil case ma.FieldCid: m.ResetCid() return nil case ma.FieldURI: m.ResetURI() return nil case ma.FieldCidRoot: m.ResetCidRoot() return nil case ma.FieldURIRoot: m.ResetURIRoot() return nil case ma.FieldRoot: m.ResetRoot() return nil case ma.FieldRkey: m.ResetRkey() return nil case ma.FieldBskyURL: m.ResetBskyURL() return nil case ma.FieldComment: m.ResetComment() return nil case ma.FieldBlog: m.ResetBlog() return nil case ma.FieldBlogURL: m.ResetBlogURL() return nil case ma.FieldDomain: m.ResetDomain() return nil case ma.FieldHost: m.ResetHost() return nil case ma.FieldFeed: m.ResetFeed() return nil case ma.FieldUpdatedAt: m.ResetUpdatedAt() return nil case ma.FieldCreatedAt: m.ResetCreatedAt() return nil } return fmt.Errorf("unknown Ma field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *MaMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.owner != nil { edges = append(edges, ma.EdgeOwner) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *MaMutation) AddedIDs(name string) []ent.Value { switch name { case ma.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 *MaMutation) 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 *MaMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *MaMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedowner { edges = append(edges, ma.EdgeOwner) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *MaMutation) EdgeCleared(name string) bool { switch name { case ma.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 *MaMutation) ClearEdge(name string) error { switch name { case ma.EdgeOwner: m.ClearOwner() return nil } return fmt.Errorf("unknown Ma 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 *MaMutation) ResetEdge(name string) error { switch name { case ma.EdgeOwner: m.ResetOwner() return nil } return fmt.Errorf("unknown Ma edge %s", name) } // SevMutation represents an operation that mutates the Sev nodes in the graph. type SevMutation struct { config op Op typ string id *int password *string token *string _limit *bool count *int addcount *int handle *string did *string uid *int adduid *int cid *int addcid *int cp *int addcp *int card *int addcard *int updated_at *time.Time created_at *time.Time clearedFields map[string]struct{} owner *int clearedowner bool done bool oldValue func(context.Context) (*Sev, error) predicates []predicate.Sev } var _ ent.Mutation = (*SevMutation)(nil) // sevOption allows management of the mutation configuration using functional options. type sevOption func(*SevMutation) // newSevMutation creates new mutation for the Sev entity. func newSevMutation(c config, op Op, opts ...sevOption) *SevMutation { m := &SevMutation{ config: c, op: op, typ: TypeSev, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withSevID sets the ID field of the mutation. func withSevID(id int) sevOption { return func(m *SevMutation) { var ( err error once sync.Once value *Sev ) m.oldValue = func(ctx context.Context) (*Sev, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Sev.Get(ctx, id) } }) return value, err } m.id = &id } } // withSev sets the old Sev of the mutation. func withSev(node *Sev) sevOption { return func(m *SevMutation) { m.oldValue = func(context.Context) (*Sev, 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 SevMutation) 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 SevMutation) 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 *SevMutation) 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 *SevMutation) 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().Sev.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 *SevMutation) SetPassword(s string) { m.password = &s } // Password returns the value of the "password" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ResetPassword() { m.password = nil } // SetToken sets the "token" field. func (m *SevMutation) SetToken(s string) { m.token = &s } // Token returns the value of the "token" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ClearToken() { m.token = nil m.clearedFields[sev.FieldToken] = struct{}{} } // TokenCleared returns if the "token" field was cleared in this mutation. func (m *SevMutation) TokenCleared() bool { _, ok := m.clearedFields[sev.FieldToken] return ok } // ResetToken resets all changes to the "token" field. func (m *SevMutation) ResetToken() { m.token = nil delete(m.clearedFields, sev.FieldToken) } // SetLimit sets the "limit" field. func (m *SevMutation) SetLimit(b bool) { m._limit = &b } // Limit returns the value of the "limit" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ClearLimit() { m._limit = nil m.clearedFields[sev.FieldLimit] = struct{}{} } // LimitCleared returns if the "limit" field was cleared in this mutation. func (m *SevMutation) LimitCleared() bool { _, ok := m.clearedFields[sev.FieldLimit] return ok } // ResetLimit resets all changes to the "limit" field. func (m *SevMutation) ResetLimit() { m._limit = nil delete(m.clearedFields, sev.FieldLimit) } // SetCount sets the "count" field. func (m *SevMutation) SetCount(i int) { m.count = &i m.addcount = nil } // Count returns the value of the "count" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) ClearCount() { m.count = nil m.addcount = nil m.clearedFields[sev.FieldCount] = struct{}{} } // CountCleared returns if the "count" field was cleared in this mutation. func (m *SevMutation) CountCleared() bool { _, ok := m.clearedFields[sev.FieldCount] return ok } // ResetCount resets all changes to the "count" field. func (m *SevMutation) ResetCount() { m.count = nil m.addcount = nil delete(m.clearedFields, sev.FieldCount) } // SetHandle sets the "handle" field. func (m *SevMutation) SetHandle(s string) { m.handle = &s } // Handle returns the value of the "handle" field in the mutation. func (m *SevMutation) Handle() (r string, exists bool) { v := m.handle if v == nil { return } return *v, true } // OldHandle returns the old "handle" field's value of the Sev entity. // If the Sev 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 *SevMutation) OldHandle(ctx context.Context) (v string, 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 *SevMutation) ClearHandle() { m.handle = nil m.clearedFields[sev.FieldHandle] = struct{}{} } // HandleCleared returns if the "handle" field was cleared in this mutation. func (m *SevMutation) HandleCleared() bool { _, ok := m.clearedFields[sev.FieldHandle] return ok } // ResetHandle resets all changes to the "handle" field. func (m *SevMutation) ResetHandle() { m.handle = nil delete(m.clearedFields, sev.FieldHandle) } // SetDid sets the "did" field. func (m *SevMutation) SetDid(s string) { m.did = &s } // Did returns the value of the "did" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ClearDid() { m.did = nil m.clearedFields[sev.FieldDid] = struct{}{} } // DidCleared returns if the "did" field was cleared in this mutation. func (m *SevMutation) DidCleared() bool { _, ok := m.clearedFields[sev.FieldDid] return ok } // ResetDid resets all changes to the "did" field. func (m *SevMutation) ResetDid() { m.did = nil delete(m.clearedFields, sev.FieldDid) } // SetUID sets the "uid" field. func (m *SevMutation) SetUID(i int) { m.uid = &i m.adduid = nil } // UID returns the value of the "uid" field in the mutation. func (m *SevMutation) UID() (r int, exists bool) { v := m.uid if v == nil { return } return *v, true } // OldUID returns the old "uid" field's value of the Sev entity. // If the Sev 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 *SevMutation) OldUID(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldUID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldUID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldUID: %w", err) } return oldValue.UID, nil } // AddUID adds i to the "uid" field. func (m *SevMutation) AddUID(i int) { if m.adduid != nil { *m.adduid += i } else { m.adduid = &i } } // AddedUID returns the value that was added to the "uid" field in this mutation. func (m *SevMutation) AddedUID() (r int, exists bool) { v := m.adduid if v == nil { return } return *v, true } // ClearUID clears the value of the "uid" field. func (m *SevMutation) ClearUID() { m.uid = nil m.adduid = nil m.clearedFields[sev.FieldUID] = struct{}{} } // UIDCleared returns if the "uid" field was cleared in this mutation. func (m *SevMutation) UIDCleared() bool { _, ok := m.clearedFields[sev.FieldUID] return ok } // ResetUID resets all changes to the "uid" field. func (m *SevMutation) ResetUID() { m.uid = nil m.adduid = nil delete(m.clearedFields, sev.FieldUID) } // SetCid sets the "cid" field. func (m *SevMutation) SetCid(i int) { m.cid = &i m.addcid = nil } // Cid returns the value of the "cid" field in the mutation. func (m *SevMutation) Cid() (r int, exists bool) { v := m.cid if v == nil { return } return *v, true } // OldCid returns the old "cid" field's value of the Sev entity. // If the Sev 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 *SevMutation) OldCid(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCid is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldCid requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldCid: %w", err) } return oldValue.Cid, nil } // AddCid adds i to the "cid" field. func (m *SevMutation) AddCid(i int) { if m.addcid != nil { *m.addcid += i } else { m.addcid = &i } } // AddedCid returns the value that was added to the "cid" field in this mutation. func (m *SevMutation) AddedCid() (r int, exists bool) { v := m.addcid if v == nil { return } return *v, true } // ClearCid clears the value of the "cid" field. func (m *SevMutation) ClearCid() { m.cid = nil m.addcid = nil m.clearedFields[sev.FieldCid] = struct{}{} } // CidCleared returns if the "cid" field was cleared in this mutation. func (m *SevMutation) CidCleared() bool { _, ok := m.clearedFields[sev.FieldCid] return ok } // ResetCid resets all changes to the "cid" field. func (m *SevMutation) ResetCid() { m.cid = nil m.addcid = nil delete(m.clearedFields, sev.FieldCid) } // SetCp sets the "cp" field. func (m *SevMutation) SetCp(i int) { m.cp = &i m.addcp = nil } // Cp returns the value of the "cp" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) ClearCp() { m.cp = nil m.addcp = nil m.clearedFields[sev.FieldCp] = struct{}{} } // CpCleared returns if the "cp" field was cleared in this mutation. func (m *SevMutation) CpCleared() bool { _, ok := m.clearedFields[sev.FieldCp] return ok } // ResetCp resets all changes to the "cp" field. func (m *SevMutation) ResetCp() { m.cp = nil m.addcp = nil delete(m.clearedFields, sev.FieldCp) } // SetCard sets the "card" field. func (m *SevMutation) SetCard(i int) { m.card = &i m.addcard = nil } // Card returns the value of the "card" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) 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 *SevMutation) ClearCard() { m.card = nil m.addcard = nil m.clearedFields[sev.FieldCard] = struct{}{} } // CardCleared returns if the "card" field was cleared in this mutation. func (m *SevMutation) CardCleared() bool { _, ok := m.clearedFields[sev.FieldCard] return ok } // ResetCard resets all changes to the "card" field. func (m *SevMutation) ResetCard() { m.card = nil m.addcard = nil delete(m.clearedFields, sev.FieldCard) } // SetUpdatedAt sets the "updated_at" field. func (m *SevMutation) SetUpdatedAt(t time.Time) { m.updated_at = &t } // UpdatedAt returns the value of the "updated_at" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ClearUpdatedAt() { m.updated_at = nil m.clearedFields[sev.FieldUpdatedAt] = struct{}{} } // UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation. func (m *SevMutation) UpdatedAtCleared() bool { _, ok := m.clearedFields[sev.FieldUpdatedAt] return ok } // ResetUpdatedAt resets all changes to the "updated_at" field. func (m *SevMutation) ResetUpdatedAt() { m.updated_at = nil delete(m.clearedFields, sev.FieldUpdatedAt) } // SetCreatedAt sets the "created_at" field. func (m *SevMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. func (m *SevMutation) 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 Sev entity. // If the Sev 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 *SevMutation) 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 *SevMutation) ClearCreatedAt() { m.created_at = nil m.clearedFields[sev.FieldCreatedAt] = struct{}{} } // CreatedAtCleared returns if the "created_at" field was cleared in this mutation. func (m *SevMutation) CreatedAtCleared() bool { _, ok := m.clearedFields[sev.FieldCreatedAt] return ok } // ResetCreatedAt resets all changes to the "created_at" field. func (m *SevMutation) ResetCreatedAt() { m.created_at = nil delete(m.clearedFields, sev.FieldCreatedAt) } // SetOwnerID sets the "owner" edge to the User entity by id. func (m *SevMutation) SetOwnerID(id int) { m.owner = &id } // ClearOwner clears the "owner" edge to the User entity. func (m *SevMutation) ClearOwner() { m.clearedowner = true } // OwnerCleared reports if the "owner" edge to the User entity was cleared. func (m *SevMutation) OwnerCleared() bool { return m.clearedowner } // OwnerID returns the "owner" edge ID in the mutation. func (m *SevMutation) 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 *SevMutation) OwnerIDs() (ids []int) { if id := m.owner; id != nil { ids = append(ids, *id) } return } // ResetOwner resets all changes to the "owner" edge. func (m *SevMutation) ResetOwner() { m.owner = nil m.clearedowner = false } // Where appends a list predicates to the SevMutation builder. func (m *SevMutation) Where(ps ...predicate.Sev) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the SevMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *SevMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Sev, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *SevMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *SevMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Sev). func (m *SevMutation) 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 *SevMutation) Fields() []string { fields := make([]string, 0, 12) if m.password != nil { fields = append(fields, sev.FieldPassword) } if m.token != nil { fields = append(fields, sev.FieldToken) } if m._limit != nil { fields = append(fields, sev.FieldLimit) } if m.count != nil { fields = append(fields, sev.FieldCount) } if m.handle != nil { fields = append(fields, sev.FieldHandle) } if m.did != nil { fields = append(fields, sev.FieldDid) } if m.uid != nil { fields = append(fields, sev.FieldUID) } if m.cid != nil { fields = append(fields, sev.FieldCid) } if m.cp != nil { fields = append(fields, sev.FieldCp) } if m.card != nil { fields = append(fields, sev.FieldCard) } if m.updated_at != nil { fields = append(fields, sev.FieldUpdatedAt) } if m.created_at != nil { fields = append(fields, sev.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 *SevMutation) Field(name string) (ent.Value, bool) { switch name { case sev.FieldPassword: return m.Password() case sev.FieldToken: return m.Token() case sev.FieldLimit: return m.Limit() case sev.FieldCount: return m.Count() case sev.FieldHandle: return m.Handle() case sev.FieldDid: return m.Did() case sev.FieldUID: return m.UID() case sev.FieldCid: return m.Cid() case sev.FieldCp: return m.Cp() case sev.FieldCard: return m.Card() case sev.FieldUpdatedAt: return m.UpdatedAt() case sev.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 *SevMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case sev.FieldPassword: return m.OldPassword(ctx) case sev.FieldToken: return m.OldToken(ctx) case sev.FieldLimit: return m.OldLimit(ctx) case sev.FieldCount: return m.OldCount(ctx) case sev.FieldHandle: return m.OldHandle(ctx) case sev.FieldDid: return m.OldDid(ctx) case sev.FieldUID: return m.OldUID(ctx) case sev.FieldCid: return m.OldCid(ctx) case sev.FieldCp: return m.OldCp(ctx) case sev.FieldCard: return m.OldCard(ctx) case sev.FieldUpdatedAt: return m.OldUpdatedAt(ctx) case sev.FieldCreatedAt: return m.OldCreatedAt(ctx) } return nil, fmt.Errorf("unknown Sev 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 *SevMutation) SetField(name string, value ent.Value) error { switch name { case sev.FieldPassword: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPassword(v) return nil case sev.FieldToken: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetToken(v) return nil case sev.FieldLimit: v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLimit(v) return nil case sev.FieldCount: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCount(v) return nil case sev.FieldHandle: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetHandle(v) return nil case sev.FieldDid: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetDid(v) return nil case sev.FieldUID: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetUID(v) return nil case sev.FieldCid: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCid(v) return nil case sev.FieldCp: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCp(v) return nil case sev.FieldCard: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCard(v) return nil case sev.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 sev.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 Sev field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *SevMutation) AddedFields() []string { var fields []string if m.addcount != nil { fields = append(fields, sev.FieldCount) } if m.adduid != nil { fields = append(fields, sev.FieldUID) } if m.addcid != nil { fields = append(fields, sev.FieldCid) } if m.addcp != nil { fields = append(fields, sev.FieldCp) } if m.addcard != nil { fields = append(fields, sev.FieldCard) } 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 *SevMutation) AddedField(name string) (ent.Value, bool) { switch name { case sev.FieldCount: return m.AddedCount() case sev.FieldUID: return m.AddedUID() case sev.FieldCid: return m.AddedCid() case sev.FieldCp: return m.AddedCp() case sev.FieldCard: return m.AddedCard() } 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 *SevMutation) AddField(name string, value ent.Value) error { switch name { case sev.FieldCount: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddCount(v) return nil case sev.FieldUID: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddUID(v) return nil case sev.FieldCid: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddCid(v) return nil case sev.FieldCp: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddCp(v) return nil case sev.FieldCard: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddCard(v) return nil } return fmt.Errorf("unknown Sev numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *SevMutation) ClearedFields() []string { var fields []string if m.FieldCleared(sev.FieldToken) { fields = append(fields, sev.FieldToken) } if m.FieldCleared(sev.FieldLimit) { fields = append(fields, sev.FieldLimit) } if m.FieldCleared(sev.FieldCount) { fields = append(fields, sev.FieldCount) } if m.FieldCleared(sev.FieldHandle) { fields = append(fields, sev.FieldHandle) } if m.FieldCleared(sev.FieldDid) { fields = append(fields, sev.FieldDid) } if m.FieldCleared(sev.FieldUID) { fields = append(fields, sev.FieldUID) } if m.FieldCleared(sev.FieldCid) { fields = append(fields, sev.FieldCid) } if m.FieldCleared(sev.FieldCp) { fields = append(fields, sev.FieldCp) } if m.FieldCleared(sev.FieldCard) { fields = append(fields, sev.FieldCard) } if m.FieldCleared(sev.FieldUpdatedAt) { fields = append(fields, sev.FieldUpdatedAt) } if m.FieldCleared(sev.FieldCreatedAt) { fields = append(fields, sev.FieldCreatedAt) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *SevMutation) 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 *SevMutation) ClearField(name string) error { switch name { case sev.FieldToken: m.ClearToken() return nil case sev.FieldLimit: m.ClearLimit() return nil case sev.FieldCount: m.ClearCount() return nil case sev.FieldHandle: m.ClearHandle() return nil case sev.FieldDid: m.ClearDid() return nil case sev.FieldUID: m.ClearUID() return nil case sev.FieldCid: m.ClearCid() return nil case sev.FieldCp: m.ClearCp() return nil case sev.FieldCard: m.ClearCard() return nil case sev.FieldUpdatedAt: m.ClearUpdatedAt() return nil case sev.FieldCreatedAt: m.ClearCreatedAt() return nil } return fmt.Errorf("unknown Sev 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 *SevMutation) ResetField(name string) error { switch name { case sev.FieldPassword: m.ResetPassword() return nil case sev.FieldToken: m.ResetToken() return nil case sev.FieldLimit: m.ResetLimit() return nil case sev.FieldCount: m.ResetCount() return nil case sev.FieldHandle: m.ResetHandle() return nil case sev.FieldDid: m.ResetDid() return nil case sev.FieldUID: m.ResetUID() return nil case sev.FieldCid: m.ResetCid() return nil case sev.FieldCp: m.ResetCp() return nil case sev.FieldCard: m.ResetCard() return nil case sev.FieldUpdatedAt: m.ResetUpdatedAt() return nil case sev.FieldCreatedAt: m.ResetCreatedAt() return nil } return fmt.Errorf("unknown Sev field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *SevMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.owner != nil { edges = append(edges, sev.EdgeOwner) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *SevMutation) AddedIDs(name string) []ent.Value { switch name { case sev.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 *SevMutation) 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 *SevMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *SevMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedowner { edges = append(edges, sev.EdgeOwner) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *SevMutation) EdgeCleared(name string) bool { switch name { case sev.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 *SevMutation) ClearEdge(name string) error { switch name { case sev.EdgeOwner: m.ClearOwner() return nil } return fmt.Errorf("unknown Sev 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 *SevMutation) ResetEdge(name string) error { switch name { case sev.EdgeOwner: m.ResetOwner() return nil } return fmt.Errorf("unknown Sev 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 game_lv *string game_exp *string game_id *string game_story *int addgame_story *int game_ep *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) } // SetGameLv sets the "game_lv" field. func (m *UeMutation) SetGameLv(s string) { m.game_lv = &s } // GameLv returns the value of the "game_lv" field in the mutation. func (m *UeMutation) GameLv() (r string, exists bool) { v := m.game_lv if v == nil { return } return *v, true } // OldGameLv returns the old "game_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) OldGameLv(ctx context.Context) (v string, 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 } // ClearGameLv clears the value of the "game_lv" field. func (m *UeMutation) ClearGameLv() { m.game_lv = nil m.clearedFields[ue.FieldGameLv] = struct{}{} } // GameLvCleared returns if the "game_lv" field was cleared in this mutation. func (m *UeMutation) GameLvCleared() bool { _, ok := m.clearedFields[ue.FieldGameLv] return ok } // ResetGameLv resets all changes to the "game_lv" field. func (m *UeMutation) ResetGameLv() { m.game_lv = nil delete(m.clearedFields, ue.FieldGameLv) } // SetGameExp sets the "game_exp" field. func (m *UeMutation) SetGameExp(s string) { m.game_exp = &s } // GameExp returns the value of the "game_exp" field in the mutation. func (m *UeMutation) GameExp() (r string, exists bool) { v := m.game_exp if v == nil { return } return *v, true } // OldGameExp returns the old "game_exp" 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) OldGameExp(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameExp is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameExp requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameExp: %w", err) } return oldValue.GameExp, nil } // ClearGameExp clears the value of the "game_exp" field. func (m *UeMutation) ClearGameExp() { m.game_exp = nil m.clearedFields[ue.FieldGameExp] = struct{}{} } // GameExpCleared returns if the "game_exp" field was cleared in this mutation. func (m *UeMutation) GameExpCleared() bool { _, ok := m.clearedFields[ue.FieldGameExp] return ok } // ResetGameExp resets all changes to the "game_exp" field. func (m *UeMutation) ResetGameExp() { m.game_exp = nil delete(m.clearedFields, ue.FieldGameExp) } // SetGameID sets the "game_id" field. func (m *UeMutation) SetGameID(s string) { m.game_id = &s } // GameID returns the value of the "game_id" field in the mutation. func (m *UeMutation) GameID() (r string, exists bool) { v := m.game_id if v == nil { return } return *v, true } // OldGameID returns the old "game_id" 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) OldGameID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameID: %w", err) } return oldValue.GameID, nil } // ClearGameID clears the value of the "game_id" field. func (m *UeMutation) ClearGameID() { m.game_id = nil m.clearedFields[ue.FieldGameID] = struct{}{} } // GameIDCleared returns if the "game_id" field was cleared in this mutation. func (m *UeMutation) GameIDCleared() bool { _, ok := m.clearedFields[ue.FieldGameID] return ok } // ResetGameID resets all changes to the "game_id" field. func (m *UeMutation) ResetGameID() { m.game_id = nil delete(m.clearedFields, ue.FieldGameID) } // SetGameStory sets the "game_story" field. func (m *UeMutation) SetGameStory(i int) { m.game_story = &i m.addgame_story = nil } // GameStory returns the value of the "game_story" field in the mutation. func (m *UeMutation) GameStory() (r int, exists bool) { v := m.game_story if v == nil { return } return *v, true } // OldGameStory returns the old "game_story" 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) OldGameStory(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameStory is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameStory requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameStory: %w", err) } return oldValue.GameStory, nil } // AddGameStory adds i to the "game_story" field. func (m *UeMutation) AddGameStory(i int) { if m.addgame_story != nil { *m.addgame_story += i } else { m.addgame_story = &i } } // AddedGameStory returns the value that was added to the "game_story" field in this mutation. func (m *UeMutation) AddedGameStory() (r int, exists bool) { v := m.addgame_story if v == nil { return } return *v, true } // ClearGameStory clears the value of the "game_story" field. func (m *UeMutation) ClearGameStory() { m.game_story = nil m.addgame_story = nil m.clearedFields[ue.FieldGameStory] = struct{}{} } // GameStoryCleared returns if the "game_story" field was cleared in this mutation. func (m *UeMutation) GameStoryCleared() bool { _, ok := m.clearedFields[ue.FieldGameStory] return ok } // ResetGameStory resets all changes to the "game_story" field. func (m *UeMutation) ResetGameStory() { m.game_story = nil m.addgame_story = nil delete(m.clearedFields, ue.FieldGameStory) } // SetGameEp sets the "game_ep" field. func (m *UeMutation) SetGameEp(s string) { m.game_ep = &s } // GameEp returns the value of the "game_ep" field in the mutation. func (m *UeMutation) GameEp() (r string, exists bool) { v := m.game_ep if v == nil { return } return *v, true } // OldGameEp returns the old "game_ep" 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) OldGameEp(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameEp is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameEp requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameEp: %w", err) } return oldValue.GameEp, nil } // ClearGameEp clears the value of the "game_ep" field. func (m *UeMutation) ClearGameEp() { m.game_ep = nil m.clearedFields[ue.FieldGameEp] = struct{}{} } // GameEpCleared returns if the "game_ep" field was cleared in this mutation. func (m *UeMutation) GameEpCleared() bool { _, ok := m.clearedFields[ue.FieldGameEp] return ok } // ResetGameEp resets all changes to the "game_ep" field. func (m *UeMutation) ResetGameEp() { m.game_ep = nil delete(m.clearedFields, ue.FieldGameEp) } // 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, 24) 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.game_lv != nil { fields = append(fields, ue.FieldGameLv) } if m.game_exp != nil { fields = append(fields, ue.FieldGameExp) } if m.game_id != nil { fields = append(fields, ue.FieldGameID) } if m.game_story != nil { fields = append(fields, ue.FieldGameStory) } if m.game_ep != nil { fields = append(fields, ue.FieldGameEp) } 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.FieldGameLv: return m.GameLv() case ue.FieldGameExp: return m.GameExp() case ue.FieldGameID: return m.GameID() case ue.FieldGameStory: return m.GameStory() case ue.FieldGameEp: return m.GameEp() 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.FieldGameLv: return m.OldGameLv(ctx) case ue.FieldGameExp: return m.OldGameExp(ctx) case ue.FieldGameID: return m.OldGameID(ctx) case ue.FieldGameStory: return m.OldGameStory(ctx) case ue.FieldGameEp: return m.OldGameEp(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.FieldGameLv: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameLv(v) return nil case ue.FieldGameExp: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameExp(v) return nil case ue.FieldGameID: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameID(v) return nil case ue.FieldGameStory: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameStory(v) return nil case ue.FieldGameEp: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameEp(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) } if m.addgame_story != nil { fields = append(fields, ue.FieldGameStory) } 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() case ue.FieldGameStory: return m.AddedGameStory() } 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 case ue.FieldGameStory: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddGameStory(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.FieldGameLv) { fields = append(fields, ue.FieldGameLv) } if m.FieldCleared(ue.FieldGameExp) { fields = append(fields, ue.FieldGameExp) } if m.FieldCleared(ue.FieldGameID) { fields = append(fields, ue.FieldGameID) } if m.FieldCleared(ue.FieldGameStory) { fields = append(fields, ue.FieldGameStory) } if m.FieldCleared(ue.FieldGameEp) { fields = append(fields, ue.FieldGameEp) } 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.FieldGameLv: m.ClearGameLv() return nil case ue.FieldGameExp: m.ClearGameExp() return nil case ue.FieldGameID: m.ClearGameID() return nil case ue.FieldGameStory: m.ClearGameStory() return nil case ue.FieldGameEp: m.ClearGameEp() 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.FieldGameLv: m.ResetGameLv() return nil case ue.FieldGameExp: m.ResetGameExp() return nil case ue.FieldGameID: m.ResetGameID() return nil case ue.FieldGameStory: m.ResetGameStory() return nil case ue.FieldGameEp: m.ResetGameEp() 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 game_exp *int addgame_exp *int game_story *int addgame_story *int game_limit *bool coin *int addcoin *int coin_open *bool coin_at *time.Time planet *int addplanet *int planet_at *time.Time login *bool login_at *time.Time location_x *int addlocation_x *int location_y *int addlocation_y *int location_z *int addlocation_z *int location_n *int addlocation_n *int clearedFields map[string]struct{} card map[int]struct{} removedcard map[int]struct{} clearedcard bool ue map[int]struct{} removedue map[int]struct{} clearedue bool ma map[int]struct{} removedma map[int]struct{} clearedma bool sev map[int]struct{} removedsev map[int]struct{} clearedsev 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) } // SetGameExp sets the "game_exp" field. func (m *UserMutation) SetGameExp(i int) { m.game_exp = &i m.addgame_exp = nil } // GameExp returns the value of the "game_exp" field in the mutation. func (m *UserMutation) GameExp() (r int, exists bool) { v := m.game_exp if v == nil { return } return *v, true } // OldGameExp returns the old "game_exp" 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) OldGameExp(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameExp is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameExp requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameExp: %w", err) } return oldValue.GameExp, nil } // AddGameExp adds i to the "game_exp" field. func (m *UserMutation) AddGameExp(i int) { if m.addgame_exp != nil { *m.addgame_exp += i } else { m.addgame_exp = &i } } // AddedGameExp returns the value that was added to the "game_exp" field in this mutation. func (m *UserMutation) AddedGameExp() (r int, exists bool) { v := m.addgame_exp if v == nil { return } return *v, true } // ClearGameExp clears the value of the "game_exp" field. func (m *UserMutation) ClearGameExp() { m.game_exp = nil m.addgame_exp = nil m.clearedFields[user.FieldGameExp] = struct{}{} } // GameExpCleared returns if the "game_exp" field was cleared in this mutation. func (m *UserMutation) GameExpCleared() bool { _, ok := m.clearedFields[user.FieldGameExp] return ok } // ResetGameExp resets all changes to the "game_exp" field. func (m *UserMutation) ResetGameExp() { m.game_exp = nil m.addgame_exp = nil delete(m.clearedFields, user.FieldGameExp) } // SetGameStory sets the "game_story" field. func (m *UserMutation) SetGameStory(i int) { m.game_story = &i m.addgame_story = nil } // GameStory returns the value of the "game_story" field in the mutation. func (m *UserMutation) GameStory() (r int, exists bool) { v := m.game_story if v == nil { return } return *v, true } // OldGameStory returns the old "game_story" 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) OldGameStory(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameStory is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameStory requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameStory: %w", err) } return oldValue.GameStory, nil } // AddGameStory adds i to the "game_story" field. func (m *UserMutation) AddGameStory(i int) { if m.addgame_story != nil { *m.addgame_story += i } else { m.addgame_story = &i } } // AddedGameStory returns the value that was added to the "game_story" field in this mutation. func (m *UserMutation) AddedGameStory() (r int, exists bool) { v := m.addgame_story if v == nil { return } return *v, true } // ClearGameStory clears the value of the "game_story" field. func (m *UserMutation) ClearGameStory() { m.game_story = nil m.addgame_story = nil m.clearedFields[user.FieldGameStory] = struct{}{} } // GameStoryCleared returns if the "game_story" field was cleared in this mutation. func (m *UserMutation) GameStoryCleared() bool { _, ok := m.clearedFields[user.FieldGameStory] return ok } // ResetGameStory resets all changes to the "game_story" field. func (m *UserMutation) ResetGameStory() { m.game_story = nil m.addgame_story = nil delete(m.clearedFields, user.FieldGameStory) } // SetGameLimit sets the "game_limit" field. func (m *UserMutation) SetGameLimit(b bool) { m.game_limit = &b } // GameLimit returns the value of the "game_limit" field in the mutation. func (m *UserMutation) GameLimit() (r bool, exists bool) { v := m.game_limit if v == nil { return } return *v, true } // OldGameLimit returns the old "game_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) OldGameLimit(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGameLimit is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGameLimit requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGameLimit: %w", err) } return oldValue.GameLimit, nil } // ClearGameLimit clears the value of the "game_limit" field. func (m *UserMutation) ClearGameLimit() { m.game_limit = nil m.clearedFields[user.FieldGameLimit] = struct{}{} } // GameLimitCleared returns if the "game_limit" field was cleared in this mutation. func (m *UserMutation) GameLimitCleared() bool { _, ok := m.clearedFields[user.FieldGameLimit] return ok } // ResetGameLimit resets all changes to the "game_limit" field. func (m *UserMutation) ResetGameLimit() { m.game_limit = nil delete(m.clearedFields, user.FieldGameLimit) } // 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) } // SetPlanet sets the "planet" field. func (m *UserMutation) SetPlanet(i int) { m.planet = &i m.addplanet = nil } // Planet returns the value of the "planet" field in the mutation. func (m *UserMutation) Planet() (r int, exists bool) { v := m.planet if v == nil { return } return *v, true } // OldPlanet returns the old "planet" 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) OldPlanet(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldPlanet is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldPlanet requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldPlanet: %w", err) } return oldValue.Planet, nil } // AddPlanet adds i to the "planet" field. func (m *UserMutation) AddPlanet(i int) { if m.addplanet != nil { *m.addplanet += i } else { m.addplanet = &i } } // AddedPlanet returns the value that was added to the "planet" field in this mutation. func (m *UserMutation) AddedPlanet() (r int, exists bool) { v := m.addplanet if v == nil { return } return *v, true } // ClearPlanet clears the value of the "planet" field. func (m *UserMutation) ClearPlanet() { m.planet = nil m.addplanet = nil m.clearedFields[user.FieldPlanet] = struct{}{} } // PlanetCleared returns if the "planet" field was cleared in this mutation. func (m *UserMutation) PlanetCleared() bool { _, ok := m.clearedFields[user.FieldPlanet] return ok } // ResetPlanet resets all changes to the "planet" field. func (m *UserMutation) ResetPlanet() { m.planet = nil m.addplanet = nil delete(m.clearedFields, user.FieldPlanet) } // SetPlanetAt sets the "planet_at" field. func (m *UserMutation) SetPlanetAt(t time.Time) { m.planet_at = &t } // PlanetAt returns the value of the "planet_at" field in the mutation. func (m *UserMutation) PlanetAt() (r time.Time, exists bool) { v := m.planet_at if v == nil { return } return *v, true } // OldPlanetAt returns the old "planet_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) OldPlanetAt(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldPlanetAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldPlanetAt requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldPlanetAt: %w", err) } return oldValue.PlanetAt, nil } // ClearPlanetAt clears the value of the "planet_at" field. func (m *UserMutation) ClearPlanetAt() { m.planet_at = nil m.clearedFields[user.FieldPlanetAt] = struct{}{} } // PlanetAtCleared returns if the "planet_at" field was cleared in this mutation. func (m *UserMutation) PlanetAtCleared() bool { _, ok := m.clearedFields[user.FieldPlanetAt] return ok } // ResetPlanetAt resets all changes to the "planet_at" field. func (m *UserMutation) ResetPlanetAt() { m.planet_at = nil delete(m.clearedFields, user.FieldPlanetAt) } // SetLogin sets the "login" field. func (m *UserMutation) SetLogin(b bool) { m.login = &b } // Login returns the value of the "login" field in the mutation. func (m *UserMutation) Login() (r bool, exists bool) { v := m.login if v == nil { return } return *v, true } // OldLogin returns the old "login" 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) OldLogin(ctx context.Context) (v bool, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldLogin is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldLogin requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldLogin: %w", err) } return oldValue.Login, nil } // ClearLogin clears the value of the "login" field. func (m *UserMutation) ClearLogin() { m.login = nil m.clearedFields[user.FieldLogin] = struct{}{} } // LoginCleared returns if the "login" field was cleared in this mutation. func (m *UserMutation) LoginCleared() bool { _, ok := m.clearedFields[user.FieldLogin] return ok } // ResetLogin resets all changes to the "login" field. func (m *UserMutation) ResetLogin() { m.login = nil delete(m.clearedFields, user.FieldLogin) } // SetLoginAt sets the "login_at" field. func (m *UserMutation) SetLoginAt(t time.Time) { m.login_at = &t } // LoginAt returns the value of the "login_at" field in the mutation. func (m *UserMutation) LoginAt() (r time.Time, exists bool) { v := m.login_at if v == nil { return } return *v, true } // OldLoginAt returns the old "login_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) OldLoginAt(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldLoginAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldLoginAt requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldLoginAt: %w", err) } return oldValue.LoginAt, nil } // ClearLoginAt clears the value of the "login_at" field. func (m *UserMutation) ClearLoginAt() { m.login_at = nil m.clearedFields[user.FieldLoginAt] = struct{}{} } // LoginAtCleared returns if the "login_at" field was cleared in this mutation. func (m *UserMutation) LoginAtCleared() bool { _, ok := m.clearedFields[user.FieldLoginAt] return ok } // ResetLoginAt resets all changes to the "login_at" field. func (m *UserMutation) ResetLoginAt() { m.login_at = nil delete(m.clearedFields, user.FieldLoginAt) } // SetLocationX sets the "location_x" field. func (m *UserMutation) 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 *UserMutation) 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 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) 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 *UserMutation) 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 *UserMutation) 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 *UserMutation) ClearLocationX() { m.location_x = nil m.addlocation_x = nil m.clearedFields[user.FieldLocationX] = struct{}{} } // LocationXCleared returns if the "location_x" field was cleared in this mutation. func (m *UserMutation) LocationXCleared() bool { _, ok := m.clearedFields[user.FieldLocationX] return ok } // ResetLocationX resets all changes to the "location_x" field. func (m *UserMutation) ResetLocationX() { m.location_x = nil m.addlocation_x = nil delete(m.clearedFields, user.FieldLocationX) } // SetLocationY sets the "location_y" field. func (m *UserMutation) 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 *UserMutation) 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 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) 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 *UserMutation) 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 *UserMutation) 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 *UserMutation) ClearLocationY() { m.location_y = nil m.addlocation_y = nil m.clearedFields[user.FieldLocationY] = struct{}{} } // LocationYCleared returns if the "location_y" field was cleared in this mutation. func (m *UserMutation) LocationYCleared() bool { _, ok := m.clearedFields[user.FieldLocationY] return ok } // ResetLocationY resets all changes to the "location_y" field. func (m *UserMutation) ResetLocationY() { m.location_y = nil m.addlocation_y = nil delete(m.clearedFields, user.FieldLocationY) } // SetLocationZ sets the "location_z" field. func (m *UserMutation) 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 *UserMutation) 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 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) 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 *UserMutation) 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 *UserMutation) 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 *UserMutation) ClearLocationZ() { m.location_z = nil m.addlocation_z = nil m.clearedFields[user.FieldLocationZ] = struct{}{} } // LocationZCleared returns if the "location_z" field was cleared in this mutation. func (m *UserMutation) LocationZCleared() bool { _, ok := m.clearedFields[user.FieldLocationZ] return ok } // ResetLocationZ resets all changes to the "location_z" field. func (m *UserMutation) ResetLocationZ() { m.location_z = nil m.addlocation_z = nil delete(m.clearedFields, user.FieldLocationZ) } // SetLocationN sets the "location_n" field. func (m *UserMutation) 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 *UserMutation) 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 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) 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 *UserMutation) 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 *UserMutation) 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 *UserMutation) ClearLocationN() { m.location_n = nil m.addlocation_n = nil m.clearedFields[user.FieldLocationN] = struct{}{} } // LocationNCleared returns if the "location_n" field was cleared in this mutation. func (m *UserMutation) LocationNCleared() bool { _, ok := m.clearedFields[user.FieldLocationN] return ok } // ResetLocationN resets all changes to the "location_n" field. func (m *UserMutation) ResetLocationN() { m.location_n = nil m.addlocation_n = nil delete(m.clearedFields, user.FieldLocationN) } // 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 } // AddMaIDs adds the "ma" edge to the Ma entity by ids. func (m *UserMutation) AddMaIDs(ids ...int) { if m.ma == nil { m.ma = make(map[int]struct{}) } for i := range ids { m.ma[ids[i]] = struct{}{} } } // ClearMa clears the "ma" edge to the Ma entity. func (m *UserMutation) ClearMa() { m.clearedma = true } // MaCleared reports if the "ma" edge to the Ma entity was cleared. func (m *UserMutation) MaCleared() bool { return m.clearedma } // RemoveMaIDs removes the "ma" edge to the Ma entity by IDs. func (m *UserMutation) RemoveMaIDs(ids ...int) { if m.removedma == nil { m.removedma = make(map[int]struct{}) } for i := range ids { delete(m.ma, ids[i]) m.removedma[ids[i]] = struct{}{} } } // RemovedMa returns the removed IDs of the "ma" edge to the Ma entity. func (m *UserMutation) RemovedMaIDs() (ids []int) { for id := range m.removedma { ids = append(ids, id) } return } // MaIDs returns the "ma" edge IDs in the mutation. func (m *UserMutation) MaIDs() (ids []int) { for id := range m.ma { ids = append(ids, id) } return } // ResetMa resets all changes to the "ma" edge. func (m *UserMutation) ResetMa() { m.ma = nil m.clearedma = false m.removedma = nil } // AddSevIDs adds the "sev" edge to the Sev entity by ids. func (m *UserMutation) AddSevIDs(ids ...int) { if m.sev == nil { m.sev = make(map[int]struct{}) } for i := range ids { m.sev[ids[i]] = struct{}{} } } // ClearSev clears the "sev" edge to the Sev entity. func (m *UserMutation) ClearSev() { m.clearedsev = true } // SevCleared reports if the "sev" edge to the Sev entity was cleared. func (m *UserMutation) SevCleared() bool { return m.clearedsev } // RemoveSevIDs removes the "sev" edge to the Sev entity by IDs. func (m *UserMutation) RemoveSevIDs(ids ...int) { if m.removedsev == nil { m.removedsev = make(map[int]struct{}) } for i := range ids { delete(m.sev, ids[i]) m.removedsev[ids[i]] = struct{}{} } } // RemovedSev returns the removed IDs of the "sev" edge to the Sev entity. func (m *UserMutation) RemovedSevIDs() (ids []int) { for id := range m.removedsev { ids = append(ids, id) } return } // SevIDs returns the "sev" edge IDs in the mutation. func (m *UserMutation) SevIDs() (ids []int) { for id := range m.sev { ids = append(ids, id) } return } // ResetSev resets all changes to the "sev" edge. func (m *UserMutation) ResetSev() { m.sev = nil m.clearedsev = false m.removedsev = 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, 61) 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.game_exp != nil { fields = append(fields, user.FieldGameExp) } if m.game_story != nil { fields = append(fields, user.FieldGameStory) } if m.game_limit != nil { fields = append(fields, user.FieldGameLimit) } 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) } if m.planet != nil { fields = append(fields, user.FieldPlanet) } if m.planet_at != nil { fields = append(fields, user.FieldPlanetAt) } if m.login != nil { fields = append(fields, user.FieldLogin) } if m.login_at != nil { fields = append(fields, user.FieldLoginAt) } if m.location_x != nil { fields = append(fields, user.FieldLocationX) } if m.location_y != nil { fields = append(fields, user.FieldLocationY) } if m.location_z != nil { fields = append(fields, user.FieldLocationZ) } if m.location_n != nil { fields = append(fields, user.FieldLocationN) } 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.FieldGameExp: return m.GameExp() case user.FieldGameStory: return m.GameStory() case user.FieldGameLimit: return m.GameLimit() case user.FieldCoin: return m.Coin() case user.FieldCoinOpen: return m.CoinOpen() case user.FieldCoinAt: return m.CoinAt() case user.FieldPlanet: return m.Planet() case user.FieldPlanetAt: return m.PlanetAt() case user.FieldLogin: return m.Login() case user.FieldLoginAt: return m.LoginAt() case user.FieldLocationX: return m.LocationX() case user.FieldLocationY: return m.LocationY() case user.FieldLocationZ: return m.LocationZ() case user.FieldLocationN: return m.LocationN() } 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.FieldGameExp: return m.OldGameExp(ctx) case user.FieldGameStory: return m.OldGameStory(ctx) case user.FieldGameLimit: return m.OldGameLimit(ctx) case user.FieldCoin: return m.OldCoin(ctx) case user.FieldCoinOpen: return m.OldCoinOpen(ctx) case user.FieldCoinAt: return m.OldCoinAt(ctx) case user.FieldPlanet: return m.OldPlanet(ctx) case user.FieldPlanetAt: return m.OldPlanetAt(ctx) case user.FieldLogin: return m.OldLogin(ctx) case user.FieldLoginAt: return m.OldLoginAt(ctx) case user.FieldLocationX: return m.OldLocationX(ctx) case user.FieldLocationY: return m.OldLocationY(ctx) case user.FieldLocationZ: return m.OldLocationZ(ctx) case user.FieldLocationN: return m.OldLocationN(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.FieldGameExp: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameExp(v) return nil case user.FieldGameStory: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameStory(v) return nil case user.FieldGameLimit: v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGameLimit(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 case user.FieldPlanet: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPlanet(v) return nil case user.FieldPlanetAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPlanetAt(v) return nil case user.FieldLogin: v, ok := value.(bool) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLogin(v) return nil case user.FieldLoginAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLoginAt(v) return nil case user.FieldLocationX: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLocationX(v) return nil case user.FieldLocationY: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLocationY(v) return nil case user.FieldLocationZ: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLocationZ(v) return nil case user.FieldLocationN: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetLocationN(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.addgame_exp != nil { fields = append(fields, user.FieldGameExp) } if m.addgame_story != nil { fields = append(fields, user.FieldGameStory) } if m.addcoin != nil { fields = append(fields, user.FieldCoin) } if m.addplanet != nil { fields = append(fields, user.FieldPlanet) } if m.addlocation_x != nil { fields = append(fields, user.FieldLocationX) } if m.addlocation_y != nil { fields = append(fields, user.FieldLocationY) } if m.addlocation_z != nil { fields = append(fields, user.FieldLocationZ) } if m.addlocation_n != nil { fields = append(fields, user.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 *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.FieldGameExp: return m.AddedGameExp() case user.FieldGameStory: return m.AddedGameStory() case user.FieldCoin: return m.AddedCoin() case user.FieldPlanet: return m.AddedPlanet() case user.FieldLocationX: return m.AddedLocationX() case user.FieldLocationY: return m.AddedLocationY() case user.FieldLocationZ: return m.AddedLocationZ() case user.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 *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.FieldGameExp: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddGameExp(v) return nil case user.FieldGameStory: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddGameStory(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 case user.FieldPlanet: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddPlanet(v) return nil case user.FieldLocationX: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddLocationX(v) return nil case user.FieldLocationY: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddLocationY(v) return nil case user.FieldLocationZ: v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddLocationZ(v) return nil case user.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 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.FieldGameExp) { fields = append(fields, user.FieldGameExp) } if m.FieldCleared(user.FieldGameStory) { fields = append(fields, user.FieldGameStory) } if m.FieldCleared(user.FieldGameLimit) { fields = append(fields, user.FieldGameLimit) } 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) } if m.FieldCleared(user.FieldPlanet) { fields = append(fields, user.FieldPlanet) } if m.FieldCleared(user.FieldPlanetAt) { fields = append(fields, user.FieldPlanetAt) } if m.FieldCleared(user.FieldLogin) { fields = append(fields, user.FieldLogin) } if m.FieldCleared(user.FieldLoginAt) { fields = append(fields, user.FieldLoginAt) } if m.FieldCleared(user.FieldLocationX) { fields = append(fields, user.FieldLocationX) } if m.FieldCleared(user.FieldLocationY) { fields = append(fields, user.FieldLocationY) } if m.FieldCleared(user.FieldLocationZ) { fields = append(fields, user.FieldLocationZ) } if m.FieldCleared(user.FieldLocationN) { fields = append(fields, user.FieldLocationN) } 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.FieldGameExp: m.ClearGameExp() return nil case user.FieldGameStory: m.ClearGameStory() return nil case user.FieldGameLimit: m.ClearGameLimit() return nil case user.FieldCoin: m.ClearCoin() return nil case user.FieldCoinOpen: m.ClearCoinOpen() return nil case user.FieldCoinAt: m.ClearCoinAt() return nil case user.FieldPlanet: m.ClearPlanet() return nil case user.FieldPlanetAt: m.ClearPlanetAt() return nil case user.FieldLogin: m.ClearLogin() return nil case user.FieldLoginAt: m.ClearLoginAt() return nil case user.FieldLocationX: m.ClearLocationX() return nil case user.FieldLocationY: m.ClearLocationY() return nil case user.FieldLocationZ: m.ClearLocationZ() return nil case user.FieldLocationN: m.ClearLocationN() 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.FieldGameExp: m.ResetGameExp() return nil case user.FieldGameStory: m.ResetGameStory() return nil case user.FieldGameLimit: m.ResetGameLimit() return nil case user.FieldCoin: m.ResetCoin() return nil case user.FieldCoinOpen: m.ResetCoinOpen() return nil case user.FieldCoinAt: m.ResetCoinAt() return nil case user.FieldPlanet: m.ResetPlanet() return nil case user.FieldPlanetAt: m.ResetPlanetAt() return nil case user.FieldLogin: m.ResetLogin() return nil case user.FieldLoginAt: m.ResetLoginAt() return nil case user.FieldLocationX: m.ResetLocationX() return nil case user.FieldLocationY: m.ResetLocationY() return nil case user.FieldLocationZ: m.ResetLocationZ() return nil case user.FieldLocationN: m.ResetLocationN() 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, 4) if m.card != nil { edges = append(edges, user.EdgeCard) } if m.ue != nil { edges = append(edges, user.EdgeUe) } if m.ma != nil { edges = append(edges, user.EdgeMa) } if m.sev != nil { edges = append(edges, user.EdgeSev) } 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 case user.EdgeMa: ids := make([]ent.Value, 0, len(m.ma)) for id := range m.ma { ids = append(ids, id) } return ids case user.EdgeSev: ids := make([]ent.Value, 0, len(m.sev)) for id := range m.sev { 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, 4) if m.removedcard != nil { edges = append(edges, user.EdgeCard) } if m.removedue != nil { edges = append(edges, user.EdgeUe) } if m.removedma != nil { edges = append(edges, user.EdgeMa) } if m.removedsev != nil { edges = append(edges, user.EdgeSev) } 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 case user.EdgeMa: ids := make([]ent.Value, 0, len(m.removedma)) for id := range m.removedma { ids = append(ids, id) } return ids case user.EdgeSev: ids := make([]ent.Value, 0, len(m.removedsev)) for id := range m.removedsev { 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, 4) if m.clearedcard { edges = append(edges, user.EdgeCard) } if m.clearedue { edges = append(edges, user.EdgeUe) } if m.clearedma { edges = append(edges, user.EdgeMa) } if m.clearedsev { edges = append(edges, user.EdgeSev) } 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 case user.EdgeMa: return m.clearedma case user.EdgeSev: return m.clearedsev } 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 case user.EdgeMa: m.ResetMa() return nil case user.EdgeSev: m.ResetSev() return nil } return fmt.Errorf("unknown User edge %s", name) }