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

@@ -15,9 +15,7 @@ import (
type Player struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// Steamid holds the value of the "steamid" field.
Steamid uint64 `json:",string"`
ID uint64 `json:"steamid,string"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// AvatarURL holds the value of the "avatar_url" field.
@@ -79,7 +77,7 @@ func (*Player) scanValues(columns []string) ([]interface{}, error) {
switch columns[i] {
case player.FieldVac:
values[i] = new(sql.NullBool)
case player.FieldID, player.FieldSteamid, player.FieldVacCount:
case player.FieldID, player.FieldVacCount:
values[i] = new(sql.NullInt64)
case player.FieldName, player.FieldAvatarURL, player.FieldVanityURL, player.FieldVanityURLReal, player.FieldAuthCode:
values[i] = new(sql.NullString)
@@ -105,13 +103,7 @@ func (pl *Player) assignValues(columns []string, values []interface{}) error {
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
pl.ID = int(value.Int64)
case player.FieldSteamid:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field steamid", values[i])
} else if value.Valid {
pl.Steamid = uint64(value.Int64)
}
pl.ID = uint64(value.Int64)
case player.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
@@ -210,8 +202,6 @@ func (pl *Player) String() string {
var builder strings.Builder
builder.WriteString("Player(")
builder.WriteString(fmt.Sprintf("id=%v", pl.ID))
builder.WriteString(", steamid=")
builder.WriteString(fmt.Sprintf("%v", pl.Steamid))
builder.WriteString(", name=")
builder.WriteString(pl.Name)
builder.WriteString(", avatar_url=")