[FEATURE] Detailed stats about player weapon usage and hitgroups (#1)
Reviewed-on: https://git.harting.dev/CSGOWTF/csgowtfd/pulls/1 Co-authored-by: Giovanni Harting <539@idlegandalf.com> Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
@@ -36,6 +36,8 @@ type Player struct {
|
||||
SharecodeUpdated time.Time `json:"-"`
|
||||
// AuthCode holds the value of the "auth_code" field.
|
||||
AuthCode string `json:"-"`
|
||||
// ProfileCreated holds the value of the "profile_created" field.
|
||||
ProfileCreated time.Time `json:"profile_created,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.NullInt64)
|
||||
case player.FieldName, player.FieldAvatarURL, player.FieldVanityURL, player.FieldVanityURLReal, player.FieldAuthCode:
|
||||
values[i] = new(sql.NullString)
|
||||
case player.FieldVacDate, player.FieldSteamUpdated, player.FieldSharecodeUpdated:
|
||||
case player.FieldVacDate, player.FieldSteamUpdated, player.FieldSharecodeUpdated, player.FieldProfileCreated:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Player", columns[i])
|
||||
@@ -164,6 +166,12 @@ func (pl *Player) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value.Valid {
|
||||
pl.AuthCode = value.String
|
||||
}
|
||||
case player.FieldProfileCreated:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field profile_created", values[i])
|
||||
} else if value.Valid {
|
||||
pl.ProfileCreated = value.Time
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -221,6 +229,8 @@ func (pl *Player) String() string {
|
||||
builder.WriteString(", sharecode_updated=")
|
||||
builder.WriteString(pl.SharecodeUpdated.Format(time.ANSIC))
|
||||
builder.WriteString(", auth_code=<sensitive>")
|
||||
builder.WriteString(", profile_created=")
|
||||
builder.WriteString(pl.ProfileCreated.Format(time.ANSIC))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user