fill history if an older match appeared

This commit is contained in:
2021-10-21 16:50:30 +02:00
parent d9f944c3d6
commit b39efe9d9a
9 changed files with 352 additions and 31 deletions

View File

@@ -33,6 +33,8 @@ const (
FieldAuthCode = "auth_code"
// FieldProfileCreated holds the string denoting the profile_created field in the database.
FieldProfileCreated = "profile_created"
// FieldOldestSharecodeSeen holds the string denoting the oldest_sharecode_seen field in the database.
FieldOldestSharecodeSeen = "oldest_sharecode_seen"
// EdgeStats holds the string denoting the stats edge name in mutations.
EdgeStats = "stats"
// EdgeMatches holds the string denoting the matches edge name in mutations.
@@ -67,6 +69,7 @@ var Columns = []string{
FieldSharecodeUpdated,
FieldAuthCode,
FieldProfileCreated,
FieldOldestSharecodeSeen,
}
var (

View File

@@ -170,6 +170,13 @@ func ProfileCreated(v time.Time) predicate.Player {
})
}
// OldestSharecodeSeen applies equality check predicate on the "oldest_sharecode_seen" field. It's identical to OldestSharecodeSeenEQ.
func OldestSharecodeSeen(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldOldestSharecodeSeen), v))
})
}
// NameEQ applies the EQ predicate on the "name" field.
func NameEQ(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
@@ -1245,6 +1252,131 @@ func ProfileCreatedNotNil() predicate.Player {
})
}
// OldestSharecodeSeenEQ applies the EQ predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenEQ(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenNEQ applies the NEQ predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenNEQ(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenIn applies the In predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenIn(vs ...string) predicate.Player {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Player(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(FieldOldestSharecodeSeen), v...))
})
}
// OldestSharecodeSeenNotIn applies the NotIn predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenNotIn(vs ...string) predicate.Player {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.Player(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(FieldOldestSharecodeSeen), v...))
})
}
// OldestSharecodeSeenGT applies the GT predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenGT(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenGTE applies the GTE predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenGTE(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenLT applies the LT predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenLT(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenLTE applies the LTE predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenLTE(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenContains applies the Contains predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenContains(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.Contains(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenHasPrefix applies the HasPrefix predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenHasPrefix(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.HasPrefix(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenHasSuffix applies the HasSuffix predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenHasSuffix(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.HasSuffix(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenIsNil applies the IsNil predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenIsNil() predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.IsNull(s.C(FieldOldestSharecodeSeen)))
})
}
// OldestSharecodeSeenNotNil applies the NotNil predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenNotNil() predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.NotNull(s.C(FieldOldestSharecodeSeen)))
})
}
// OldestSharecodeSeenEqualFold applies the EqualFold predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenEqualFold(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.EqualFold(s.C(FieldOldestSharecodeSeen), v))
})
}
// OldestSharecodeSeenContainsFold applies the ContainsFold predicate on the "oldest_sharecode_seen" field.
func OldestSharecodeSeenContainsFold(v string) predicate.Player {
return predicate.Player(func(s *sql.Selector) {
s.Where(sql.ContainsFold(s.C(FieldOldestSharecodeSeen), v))
})
}
// HasStats applies the HasEdge predicate on the "stats" edge.
func HasStats() predicate.Player {
return predicate.Player(func(s *sql.Selector) {