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

@@ -38,6 +38,8 @@ type Player struct {
AuthCode string `json:"-"`
// ProfileCreated holds the value of the "profile_created" field.
ProfileCreated time.Time `json:"profile_created,omitempty"`
// OldestSharecodeSeen holds the value of the "oldest_sharecode_seen" field.
OldestSharecodeSeen string `json:"oldest_sharecode_seen,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PlayerQuery when eager-loading is set.
Edges PlayerEdges `json:"edges"`
@@ -81,7 +83,7 @@ func (*Player) scanValues(columns []string) ([]interface{}, error) {
values[i] = new(sql.NullBool)
case player.FieldID, player.FieldVacCount:
values[i] = new(sql.NullInt64)
case player.FieldName, player.FieldAvatar, player.FieldVanityURL, player.FieldVanityURLReal, player.FieldAuthCode:
case player.FieldName, player.FieldAvatar, player.FieldVanityURL, player.FieldVanityURLReal, player.FieldAuthCode, player.FieldOldestSharecodeSeen:
values[i] = new(sql.NullString)
case player.FieldVacDate, player.FieldSteamUpdated, player.FieldSharecodeUpdated, player.FieldProfileCreated:
values[i] = new(sql.NullTime)
@@ -172,6 +174,12 @@ func (pl *Player) assignValues(columns []string, values []interface{}) error {
} else if value.Valid {
pl.ProfileCreated = value.Time
}
case player.FieldOldestSharecodeSeen:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field oldest_sharecode_seen", values[i])
} else if value.Valid {
pl.OldestSharecodeSeen = value.String
}
}
}
return nil
@@ -231,6 +239,8 @@ func (pl *Player) String() string {
builder.WriteString(", auth_code=<sensitive>")
builder.WriteString(", profile_created=")
builder.WriteString(pl.ProfileCreated.Format(time.ANSIC))
builder.WriteString(", oldest_sharecode_seen=")
builder.WriteString(pl.OldestSharecodeSeen)
builder.WriteByte(')')
return builder.String()
}