added tick to messages
This commit is contained in:
@@ -5284,6 +5284,8 @@ type MessagesMutation struct {
|
||||
id *int
|
||||
message *string
|
||||
all_chat *bool
|
||||
tick *int
|
||||
addtick *int
|
||||
clearedFields map[string]struct{}
|
||||
match_player *int
|
||||
clearedmatch_player bool
|
||||
@@ -5462,6 +5464,62 @@ func (m *MessagesMutation) ResetAllChat() {
|
||||
m.all_chat = nil
|
||||
}
|
||||
|
||||
// SetTick sets the "tick" field.
|
||||
func (m *MessagesMutation) SetTick(i int) {
|
||||
m.tick = &i
|
||||
m.addtick = nil
|
||||
}
|
||||
|
||||
// Tick returns the value of the "tick" field in the mutation.
|
||||
func (m *MessagesMutation) Tick() (r int, exists bool) {
|
||||
v := m.tick
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTick returns the old "tick" field's value of the Messages entity.
|
||||
// If the Messages object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MessagesMutation) OldTick(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTick is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTick requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTick: %w", err)
|
||||
}
|
||||
return oldValue.Tick, nil
|
||||
}
|
||||
|
||||
// AddTick adds i to the "tick" field.
|
||||
func (m *MessagesMutation) AddTick(i int) {
|
||||
if m.addtick != nil {
|
||||
*m.addtick += i
|
||||
} else {
|
||||
m.addtick = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedTick returns the value that was added to the "tick" field in this mutation.
|
||||
func (m *MessagesMutation) AddedTick() (r int, exists bool) {
|
||||
v := m.addtick
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetTick resets all changes to the "tick" field.
|
||||
func (m *MessagesMutation) ResetTick() {
|
||||
m.tick = nil
|
||||
m.addtick = nil
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by id.
|
||||
func (m *MessagesMutation) SetMatchPlayerID(id int) {
|
||||
m.match_player = &id
|
||||
@@ -5520,13 +5578,16 @@ func (m *MessagesMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MessagesMutation) Fields() []string {
|
||||
fields := make([]string, 0, 2)
|
||||
fields := make([]string, 0, 3)
|
||||
if m.message != nil {
|
||||
fields = append(fields, messages.FieldMessage)
|
||||
}
|
||||
if m.all_chat != nil {
|
||||
fields = append(fields, messages.FieldAllChat)
|
||||
}
|
||||
if m.tick != nil {
|
||||
fields = append(fields, messages.FieldTick)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -5539,6 +5600,8 @@ func (m *MessagesMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.Message()
|
||||
case messages.FieldAllChat:
|
||||
return m.AllChat()
|
||||
case messages.FieldTick:
|
||||
return m.Tick()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -5552,6 +5615,8 @@ func (m *MessagesMutation) OldField(ctx context.Context, name string) (ent.Value
|
||||
return m.OldMessage(ctx)
|
||||
case messages.FieldAllChat:
|
||||
return m.OldAllChat(ctx)
|
||||
case messages.FieldTick:
|
||||
return m.OldTick(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Messages field %s", name)
|
||||
}
|
||||
@@ -5575,6 +5640,13 @@ func (m *MessagesMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetAllChat(v)
|
||||
return nil
|
||||
case messages.FieldTick:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTick(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Messages field %s", name)
|
||||
}
|
||||
@@ -5582,13 +5654,21 @@ func (m *MessagesMutation) SetField(name string, value ent.Value) error {
|
||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||
// this mutation.
|
||||
func (m *MessagesMutation) AddedFields() []string {
|
||||
return nil
|
||||
var fields []string
|
||||
if m.addtick != nil {
|
||||
fields = append(fields, messages.FieldTick)
|
||||
}
|
||||
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 *MessagesMutation) AddedField(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case messages.FieldTick:
|
||||
return m.AddedTick()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
@@ -5597,6 +5677,13 @@ func (m *MessagesMutation) AddedField(name string) (ent.Value, bool) {
|
||||
// type.
|
||||
func (m *MessagesMutation) AddField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case messages.FieldTick:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddTick(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Messages numeric field %s", name)
|
||||
}
|
||||
@@ -5630,6 +5717,9 @@ func (m *MessagesMutation) ResetField(name string) error {
|
||||
case messages.FieldAllChat:
|
||||
m.ResetAllChat()
|
||||
return nil
|
||||
case messages.FieldTick:
|
||||
m.ResetTick()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Messages field %s", name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user