add to some int fields pg:',use_zero' tag

This commit is contained in:
Dawid Wysokiński 2020-06-20 17:31:21 +02:00
parent 4b7c12cbdd
commit bcad77573c
4 changed files with 21 additions and 21 deletions

View File

@ -5,15 +5,15 @@ import "time"
type Ennoblement struct {
tableName struct{} `pg:"?SERVER.ennoblements,alias:ennoblement"`
VillageID int `gqlgen:"-" json:"villageID" xml:"villageID"`
VillageID int `pg:",use_zero" gqlgen:"-" json:"villageID" xml:"villageID"`
Village *Village `gqlgen:"-" json:"village,omitempty" xml:"village"`
NewOwnerID int `gqlgen:"-" json:"newOwnerID" xml:"newOwnerID"`
NewOwnerID int `pg:",use_zero" gqlgen:"-" json:"newOwnerID" xml:"newOwnerID"`
NewOwner *Player `gqlgen:"-" json:"newOwner,omitempty" xml:"newOwner"`
NewOwnerTribeID int `json:"newOwnerTribeID" gqlgen:"newOwnerTribeID" xml:"newOwnerTribeID"`
NewOwnerTribeID int `pg:",use_zero" json:"newOwnerTribeID" gqlgen:"newOwnerTribeID" xml:"newOwnerTribeID"`
NewOwnerTribe *Tribe `json:"newOwnerTribe,omitempty" gqlgen:"-" xml:"newOwnerTribe"`
OldOwnerID int `gqlgen:"-" json:"oldOwnerID" xml:"oldOwnerID"`
OldOwnerID int `pg:",use_zero" gqlgen:"-" json:"oldOwnerID" xml:"oldOwnerID"`
OldOwner *Player `gqlgen:"-" json:"oldOwner,omitempty" xml:"oldOwner"`
OldOwnerTribeID int `json:"oldOwnerTribeID" gqlgen:"oldOwnerTribeID" xml:"oldOwnerTribeID"`
OldOwnerTribeID int `pg:",use_zero" json:"oldOwnerTribeID" gqlgen:"oldOwnerTribeID" xml:"oldOwnerTribeID"`
OldOwnerTribe *Tribe `json:"oldOwnerTribe,omitempty" gqlgen:"-" xml:"oldOwnerTribe"`
EnnobledAt time.Time `pg:"default:now(),use_zero" json:"ennobledAt" gqlgen:"ennobledAt" xml:"ennobledAt"`
}

View File

@ -8,16 +8,16 @@ import (
type ServerStats struct {
tableName struct{} `pg:"?SERVER.stats,alias:stats"`
ActivePlayers int `json:"activePlayers" gqlgen:"activePlayers" xml:"activePlayers"`
InactivePlayers int `json:"inactivePlayers" gqlgen:"inactivePlayers" xml:"inactivePlayers"`
Players int `json:"players" gqlgen:"players" xml:"players"`
ActiveTribes int `json:"activeTribes" gqlgen:"activeTribes" xml:"activeTribes"`
InactiveTribes int `json:"inactiveTribes" gqlgen:"inactiveTribes" xml:"inactiveTribes"`
Tribes int `json:"tribes" gqlgen:"tribes" xml:"tribes"`
Villages int `json:"villages" gqlgen:"villages" xml:"villages"`
BonusVillages int `json:"bonusVillages" gqlgen:"bonusVillages" xml:"bonusVillages"`
BarbarianVillages int `json:"barbarianVillages" gqlgen:"barbarianVillages" xml:"barbarianVillages"`
PlayerVillages int `json:"playerVillages" gqlgen:"playerVillages" xml:"playerVillages"`
ActivePlayers int `pg:",use_zero" json:"activePlayers" gqlgen:"activePlayers" xml:"activePlayers"`
InactivePlayers int `pg:",use_zero" json:"inactivePlayers" gqlgen:"inactivePlayers" xml:"inactivePlayers"`
Players int `pg:",use_zero" json:"players" gqlgen:"players" xml:"players"`
ActiveTribes int `pg:",use_zero" json:"activeTribes" gqlgen:"activeTribes" xml:"activeTribes"`
InactiveTribes int `pg:",use_zero" json:"inactiveTribes" gqlgen:"inactiveTribes" xml:"inactiveTribes"`
Tribes int `pg:",use_zero" json:"tribes" gqlgen:"tribes" xml:"tribes"`
Villages int `pg:",use_zero" json:"villages" gqlgen:"villages" xml:"villages"`
BonusVillages int `pg:",use_zero" json:"bonusVillages" gqlgen:"bonusVillages" xml:"bonusVillages"`
BarbarianVillages int `pg:",use_zero" json:"barbarianVillages" gqlgen:"barbarianVillages" xml:"barbarianVillages"`
PlayerVillages int `pg:",use_zero" json:"playerVillages" gqlgen:"playerVillages" xml:"playerVillages"`
CreatedAt time.Time `pg:"default:now(),use_zero" json:"createdAt" gqlgen:"createdAt" xml:"createdAt"`
}

View File

@ -8,9 +8,9 @@ import (
type Stats struct {
tableName struct{} `pg:"stats,alias:stats"`
ActiveServers int `json:"activeServers" gqlgen:"activeServers" xml:"activeServers"`
InactiveServers int `json:"inactiveServers" gqlgen:"inactiveServers" xml:"inactiveServers"`
Servers int `json:"servers" gqlgen:"servers" xml:"servers"`
ActiveServers int `pg:",use_zero" json:"activeServers" gqlgen:"activeServers" xml:"activeServers"`
InactiveServers int `pg:",use_zero" json:"inactiveServers" gqlgen:"inactiveServers" xml:"inactiveServers"`
Servers int `pg:",use_zero" json:"servers" gqlgen:"servers" xml:"servers"`
ServerStats
}

View File

@ -6,11 +6,11 @@ type TribeChange struct {
tableName struct{} `pg:"?SERVER.tribe_changes,alias:tribe_change"`
ID int `json:"id" gqlgen:"id" xml:"id"`
PlayerID int `json:"playerID" gqlgen:"playerID" xml:"playerID"`
PlayerID int `pg:",use_zero" json:"playerID" gqlgen:"playerID" xml:"playerID"`
Player *Player `json:"player,omitempty" gqlgen:"-" xml:"player"`
OldTribeID int `json:"oldTribeID" gqlgen:"oldTribeID" xml:"oldTribeID"`
OldTribeID int `pg:",use_zero" json:"oldTribeID" gqlgen:"oldTribeID" xml:"oldTribeID"`
OldTribe *Tribe `json:"oldTribe,omitempty" gqlgen:"-" xml:"oldTribe"`
NewTribeID int `json:"newTribeID" gqlgen:"newTribeID" xml:"newTribeID"`
NewTribeID int `pg:",use_zero" json:"newTribeID" gqlgen:"newTribeID" xml:"newTribeID"`
NewTribe *Tribe `json:"newTribe,omitempty" gqlgen:"-" xml:"newTribe"`
CreatedAt time.Time `pg:"default:now(),use_zero" json:"createdAt" gqlgen:"createdAt" xml:"createdAt"`
}