fixed match win/loss/ties

This commit is contained in:
2021-10-08 17:15:06 +02:00
parent 1fda101a35
commit 1816c5a2b5
28 changed files with 363 additions and 654 deletions

View File

@@ -11,28 +11,28 @@ import (
)
// ID filters vertices based on their ID field.
func ID(id int) predicate.Match {
func ID(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldID), id))
})
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int) predicate.Match {
func IDEQ(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldID), id))
})
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int) predicate.Match {
func IDNEQ(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldID), id))
})
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.Match {
func IDIn(ids ...uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
@@ -49,7 +49,7 @@ func IDIn(ids ...int) predicate.Match {
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.Match {
func IDNotIn(ids ...uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
@@ -66,40 +66,33 @@ func IDNotIn(ids ...int) predicate.Match {
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int) predicate.Match {
func IDGT(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldID), id))
})
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int) predicate.Match {
func IDGTE(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldID), id))
})
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int) predicate.Match {
func IDLT(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldID), id))
})
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int) predicate.Match {
func IDLTE(id uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldID), id))
})
}
// MatchID applies equality check predicate on the "match_id" field. It's identical to MatchIDEQ.
func MatchID(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldMatchID), v))
})
}
// ShareCode applies equality check predicate on the "share_code" field. It's identical to ShareCodeEQ.
func ShareCode(v string) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
@@ -177,82 +170,6 @@ func DemoParsed(v bool) predicate.Match {
})
}
// MatchIDEQ applies the EQ predicate on the "match_id" field.
func MatchIDEQ(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldMatchID), v))
})
}
// MatchIDNEQ applies the NEQ predicate on the "match_id" field.
func MatchIDNEQ(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldMatchID), v))
})
}
// MatchIDIn applies the In predicate on the "match_id" field.
func MatchIDIn(vs ...uint64) predicate.Match {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Match(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldMatchID), v...))
})
}
// MatchIDNotIn applies the NotIn predicate on the "match_id" field.
func MatchIDNotIn(vs ...uint64) predicate.Match {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Match(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldMatchID), v...))
})
}
// MatchIDGT applies the GT predicate on the "match_id" field.
func MatchIDGT(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldMatchID), v))
})
}
// MatchIDGTE applies the GTE predicate on the "match_id" field.
func MatchIDGTE(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldMatchID), v))
})
}
// MatchIDLT applies the LT predicate on the "match_id" field.
func MatchIDLT(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldMatchID), v))
})
}
// MatchIDLTE applies the LTE predicate on the "match_id" field.
func MatchIDLTE(v uint64) predicate.Match {
return predicate.Match(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldMatchID), v))
})
}
// ShareCodeEQ applies the EQ predicate on the "share_code" field.
func ShareCodeEQ(v string) predicate.Match {
return predicate.Match(func(s *sql.Selector) {