added vac/gameban marker for matches
This commit is contained in:
110
ent/mutation.go
110
ent/mutation.go
@@ -54,6 +54,8 @@ type MatchMutation struct {
|
||||
max_rounds *int
|
||||
addmax_rounds *int
|
||||
demo_parsed *bool
|
||||
vac_present *bool
|
||||
gameban_present *bool
|
||||
clearedFields map[string]struct{}
|
||||
stats map[int]struct{}
|
||||
removedstats map[int]struct{}
|
||||
@@ -637,6 +639,78 @@ func (m *MatchMutation) ResetDemoParsed() {
|
||||
m.demo_parsed = nil
|
||||
}
|
||||
|
||||
// SetVacPresent sets the "vac_present" field.
|
||||
func (m *MatchMutation) SetVacPresent(b bool) {
|
||||
m.vac_present = &b
|
||||
}
|
||||
|
||||
// VacPresent returns the value of the "vac_present" field in the mutation.
|
||||
func (m *MatchMutation) VacPresent() (r bool, exists bool) {
|
||||
v := m.vac_present
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldVacPresent returns the old "vac_present" field's value of the Match entity.
|
||||
// If the Match object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchMutation) OldVacPresent(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldVacPresent is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldVacPresent requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldVacPresent: %w", err)
|
||||
}
|
||||
return oldValue.VacPresent, nil
|
||||
}
|
||||
|
||||
// ResetVacPresent resets all changes to the "vac_present" field.
|
||||
func (m *MatchMutation) ResetVacPresent() {
|
||||
m.vac_present = nil
|
||||
}
|
||||
|
||||
// SetGamebanPresent sets the "gameban_present" field.
|
||||
func (m *MatchMutation) SetGamebanPresent(b bool) {
|
||||
m.gameban_present = &b
|
||||
}
|
||||
|
||||
// GamebanPresent returns the value of the "gameban_present" field in the mutation.
|
||||
func (m *MatchMutation) GamebanPresent() (r bool, exists bool) {
|
||||
v := m.gameban_present
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGamebanPresent returns the old "gameban_present" field's value of the Match entity.
|
||||
// If the Match object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchMutation) OldGamebanPresent(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldGamebanPresent is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldGamebanPresent requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGamebanPresent: %w", err)
|
||||
}
|
||||
return oldValue.GamebanPresent, nil
|
||||
}
|
||||
|
||||
// ResetGamebanPresent resets all changes to the "gameban_present" field.
|
||||
func (m *MatchMutation) ResetGamebanPresent() {
|
||||
m.gameban_present = nil
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the Stats entity by ids.
|
||||
func (m *MatchMutation) AddStatIDs(ids ...int) {
|
||||
if m.stats == nil {
|
||||
@@ -764,7 +838,7 @@ func (m *MatchMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MatchMutation) Fields() []string {
|
||||
fields := make([]string, 0, 10)
|
||||
fields := make([]string, 0, 12)
|
||||
if m.share_code != nil {
|
||||
fields = append(fields, match.FieldShareCode)
|
||||
}
|
||||
@@ -795,6 +869,12 @@ func (m *MatchMutation) Fields() []string {
|
||||
if m.demo_parsed != nil {
|
||||
fields = append(fields, match.FieldDemoParsed)
|
||||
}
|
||||
if m.vac_present != nil {
|
||||
fields = append(fields, match.FieldVacPresent)
|
||||
}
|
||||
if m.gameban_present != nil {
|
||||
fields = append(fields, match.FieldGamebanPresent)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -823,6 +903,10 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.MaxRounds()
|
||||
case match.FieldDemoParsed:
|
||||
return m.DemoParsed()
|
||||
case match.FieldVacPresent:
|
||||
return m.VacPresent()
|
||||
case match.FieldGamebanPresent:
|
||||
return m.GamebanPresent()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -852,6 +936,10 @@ func (m *MatchMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
||||
return m.OldMaxRounds(ctx)
|
||||
case match.FieldDemoParsed:
|
||||
return m.OldDemoParsed(ctx)
|
||||
case match.FieldVacPresent:
|
||||
return m.OldVacPresent(ctx)
|
||||
case match.FieldGamebanPresent:
|
||||
return m.OldGamebanPresent(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -931,6 +1019,20 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetDemoParsed(v)
|
||||
return nil
|
||||
case match.FieldVacPresent:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetVacPresent(v)
|
||||
return nil
|
||||
case match.FieldGamebanPresent:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGamebanPresent(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1088,6 +1190,12 @@ func (m *MatchMutation) ResetField(name string) error {
|
||||
case match.FieldDemoParsed:
|
||||
m.ResetDemoParsed()
|
||||
return nil
|
||||
case match.FieldVacPresent:
|
||||
m.ResetVacPresent()
|
||||
return nil
|
||||
case match.FieldGamebanPresent:
|
||||
m.ResetGamebanPresent()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user