db

package
v0.0.0-...-8cde9e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const LATEST_VERSION = 5

Variables

This section is empty.

Functions

func BattlePlansToGameBattlePlans

func BattlePlansToGameBattlePlans(source *BattlePlans) []cs.BattlePlan

func BattleRecordsToGameBattleRecords

func BattleRecordsToGameBattleRecords(source *BattleRecords) []cs.BattleRecord

func BoolToNullBool

func BoolToNullBool(source bool) sql.NullBool

func ExtendArea

func ExtendArea(source Game) cs.Vector

func ExtendBaseHab

func ExtendBaseHab(source Planet) cs.Hab

func ExtendDefaultRules

func ExtendDefaultRules(source Game) cs.Rules

func ExtendFleetFleetOrders

func ExtendFleetFleetOrders(source Fleet) cs.FleetOrders

func ExtendFleetHeading

func ExtendFleetHeading(source Fleet) cs.Vector

func ExtendFleetMapObject

func ExtendFleetMapObject(source Fleet) cs.MapObject

func ExtendFleetPreviousPosition

func ExtendFleetPreviousPosition(source Fleet) *cs.Vector

func ExtendHabHigh

func ExtendHabHigh(source Race) cs.Hab

func ExtendHabLow

func ExtendHabLow(source Race) cs.Hab

func ExtendMineFieldMapObject

func ExtendMineFieldMapObject(source MineField) cs.MapObject

func ExtendMineYears

func ExtendMineYears(source Planet) cs.Mineral

func ExtendMineralConcentration

func ExtendMineralConcentration(source Planet) cs.Mineral

func ExtendMineralPacketHeading

func ExtendMineralPacketHeading(source MineralPacket) cs.Vector

func ExtendMineralPacketMapObject

func ExtendMineralPacketMapObject(source MineralPacket) cs.MapObject

func ExtendMysteryTraderHeading

func ExtendMysteryTraderHeading(source MysteryTrader) cs.Vector

func ExtendMysteryTraderMapObject

func ExtendMysteryTraderMapObject(source MysteryTrader) cs.MapObject

func ExtendPlanetMapObject

func ExtendPlanetMapObject(source Planet) cs.MapObject

func ExtendResearchCost

func ExtendResearchCost(source Race) cs.ResearchCost

func ExtendSalvageMapObject

func ExtendSalvageMapObject(source Salvage) cs.MapObject

func ExtendTechLevels

func ExtendTechLevels(source Player) cs.TechLevel

func ExtendTechLevelsSpent

func ExtendTechLevelsSpent(source Player) cs.TechLevel

func ExtendTerraformedAmount

func ExtendTerraformedAmount(source Planet) cs.Hab

func ExtendVictoryConditions

func ExtendVictoryConditions(source Game) cs.VictoryConditions

func FleetIntelsToGameFleetIntels

func FleetIntelsToGameFleetIntels(source *FleetIntels) []cs.FleetIntel

func FleetSpecToGameFleetSpec

func FleetSpecToGameFleetSpec(source *FleetSpec) cs.FleetSpec

func MapObjectTypeWormhole

func MapObjectTypeWormhole() cs.MapObjectType

func MineFieldIntelsToGameMineFieldIntels

func MineFieldIntelsToGameMineFieldIntels(source *MineFieldIntels) []cs.MineFieldIntel

func MineFieldSpecToGameMineFieldSpec

func MineFieldSpecToGameMineFieldSpec(source *MineFieldSpec) cs.MineFieldSpec

func MineralPacketIntelsToGameMineralPacketIntels

func MineralPacketIntelsToGameMineralPacketIntels(source *MineralPacketIntels) []cs.MineralPacketIntel

func MysteryTraderIntelsToGameMysteryTraderIntels

func MysteryTraderIntelsToGameMysteryTraderIntels(source *MysteryTraderIntels) []cs.MysteryTraderIntel

func MysteryTraderSpecToGameMysteryTraderSpec

func MysteryTraderSpecToGameMysteryTraderSpec(source *MysteryTraderSpec) cs.MysteryTraderSpec

func NullBoolToBool

func NullBoolToBool(source sql.NullBool) bool

func NullTimeToTime

func NullTimeToTime(source sql.NullTime) time.Time

func PlanetIntelsToGamePlanetIntels

func PlanetIntelsToGamePlanetIntels(source *PlanetIntels) []cs.PlanetIntel

func PlanetSpecToGamePlanetSpec

func PlanetSpecToGamePlanetSpec(source *PlanetSpec) cs.PlanetSpec

func PlayerIntelsToGamePlayerIntels

func PlayerIntelsToGamePlayerIntels(source *PlayerIntels) []cs.PlayerIntel

func PlayerMessagesToGamePlayerMessages

func PlayerMessagesToGamePlayerMessages(source *PlayerMessages) []cs.PlayerMessage

func PlayerRaceToGameRace

func PlayerRaceToGameRace(source *PlayerRace) cs.Race

func PlayerRelationshipsToGamePlayerRelationships

func PlayerRelationshipsToGamePlayerRelationships(source *PlayerRelationships) []cs.PlayerRelationship

func PlayerScoresToGamePlayerScores

func PlayerScoresToGamePlayerScores(source *PlayerScores) []cs.PlayerScore

func PlayerSpecToGamePlayerSpec

func PlayerSpecToGamePlayerSpec(source *PlayerSpec) cs.PlayerSpec

func PlayerStatsToGamePlayerStats

func PlayerStatsToGamePlayerStats(source *PlayerStats) *cs.PlayerStats

func ProductionPlansToGameProductionPlans

func ProductionPlansToGameProductionPlans(source *ProductionPlans) []cs.ProductionPlan

func ProductionQueueItemsToGameProductionQueueItems

func ProductionQueueItemsToGameProductionQueueItems(source *ProductionQueueItems) []cs.ProductionQueueItem

func RaceSpecToGameRaceSpec

func RaceSpecToGameRaceSpec(source *RaceSpec) cs.RaceSpec

func RulesToGameRules

func RulesToGameRules(source *Rules) cs.Rules

func SalvageIntelsToGameSalvageIntels

func SalvageIntelsToGameSalvageIntels(source *SalvageIntels) []cs.SalvageIntel

func ScoreIntelsToGameScoreIntels

func ScoreIntelsToGameScoreIntels(source *ScoreIntels) []cs.ScoreIntel

func ShipDesignIntelsToGameShipDesignIntels

func ShipDesignIntelsToGameShipDesignIntels(source *ShipDesignIntels) []cs.ShipDesignIntel

func ShipDesignSlotsToGameShipDesignSlots

func ShipDesignSlotsToGameShipDesignSlots(source *ShipDesignSlots) []cs.ShipDesignSlot

func ShipDesignSpecToGameShipDesignSpec

func ShipDesignSpecToGameShipDesignSpec(source *ShipDesignSpec) cs.ShipDesignSpec

func ShipTokensToGameShipTokens

func ShipTokensToGameShipTokens(source *ShipTokens) []cs.ShipToken

func TagsToGameTags

func TagsToGameTags(source *Tags) cs.Tags

func TimeToNullTime

func TimeToNullTime(source time.Time) sql.NullTime

func TimeToTime

func TimeToTime(source time.Time) time.Time

func TransportPlansToGameTransportPlans

func TransportPlansToGameTransportPlans(source *TransportPlans) []cs.TransportPlan

func WaypointsToGameWaypoints

func WaypointsToGameWaypoints(source *Waypoints) []cs.Waypoint

func WormholeIntelsToGameWormholeIntels

func WormholeIntelsToGameWormholeIntels(source *WormholeIntels) []cs.WormholeIntel

func WormholeSpecToGameWormholeSpec

func WormholeSpecToGameWormholeSpec(source *WormholeSpec) cs.WormholeSpec

Types

type BattlePlans

type BattlePlans []cs.BattlePlan

we json serialize these types with custom Scan/Value methods

func GameBattlePlansToBattlePlans

func GameBattlePlansToBattlePlans(source []cs.BattlePlan) *BattlePlans

func (*BattlePlans) Scan

func (item *BattlePlans) Scan(src interface{}) error

db deserializer to read this from JSON

func (*BattlePlans) Value

func (item *BattlePlans) Value() (driver.Value, error)

db serializer to serialize this to JSON

type BattleRecords

type BattleRecords []cs.BattleRecord

func GameBattleRecordsToBattleRecords

func GameBattleRecordsToBattleRecords(source []cs.BattleRecord) *BattleRecords

func (*BattleRecords) Scan

func (item *BattleRecords) Scan(src interface{}) error

func (*BattleRecords) Value

func (item *BattleRecords) Value() (driver.Value, error)

type Client

type Client interface {
	GetUsers() ([]cs.User, error)
	GetUser(id int64) (*cs.User, error)
	GetUserByUsername(username string) (*cs.User, error)
	GetGuestUser(hash string) (*cs.User, error)
	GetGuestUserForGame(gameID int64, playerNum int) (*cs.User, error)
	GetGuestUsersForGame(gameID int64) ([]cs.User, error)
	CreateUser(user *cs.User) error
	UpdateUser(user *cs.User) error
	DeleteUser(id int64) error
	DeleteGameUsers(gameID int64) error
	GetUsersForGame(gameID int64) ([]cs.User, error)

	GetRaces() ([]cs.Race, error)
	GetRacesForUser(userID int64) ([]cs.Race, error)
	GetRace(id int64) (*cs.Race, error)
	CreateRace(race *cs.Race) error
	UpdateRace(race *cs.Race) error
	DeleteRace(id int64) error
	DeleteUserRaces(userID int64) error

	GetTechStores() ([]cs.TechStore, error)
	CreateTechStore(tech *cs.TechStore) error
	GetTechStore(id int64) (*cs.TechStore, error)

	GetRulesForGame(gameID int64) (*cs.Rules, error)

	GetGames() ([]cs.Game, error)
	GetGamesWithPlayers() ([]cs.GameWithPlayers, error)
	GetGamesForHost(userID int64) ([]cs.GameWithPlayers, error)
	GetGamesForUser(userID int64) ([]cs.GameWithPlayers, error)
	GetOpenGames() ([]cs.GameWithPlayers, error)
	GetOpenGamesByHash(hash string) ([]cs.GameWithPlayers, error)
	GetGame(id int64) (*cs.GameWithPlayers, error)
	GetGameWithPlayersStatus(gameID int64) (*cs.GameWithPlayers, error)
	GetFullGame(id int64) (*cs.FullGame, error)
	CreateGame(game *cs.Game) error
	UpdateGame(game *cs.Game) error
	UpdateGameState(gameID int64, state cs.GameState) error
	UpdateFullGame(fullGame *cs.FullGame) error
	UpdateGameHost(gameID int64, hostId int64) error
	DeleteGame(id int64) error
	DeleteUserGames(hostID int64) error

	GetPlayers() ([]cs.Player, error)
	GetPlayersForUser(userID int64) ([]cs.Player, error)
	GetPlayer(id int64) (*cs.Player, error)
	GetLightPlayerForGame(gameID, userID int64) (*cs.Player, error)
	GetPlayersStatusForGame(gameID int64) ([]*cs.Player, error)
	GetPlayerForGame(gameID, userID int64) (*cs.Player, error)
	GetPlayerIntelsForGame(gameID, userID int64) (*cs.PlayerIntels, error)
	GetPlayerByNum(gameID int64, num int) (*cs.Player, error)
	GetFullPlayerForGame(gameID, userID int64) (*cs.FullPlayer, error)
	GetPlayerMapObjects(gameID, userID int64) (*cs.PlayerMapObjects, error)
	GetPlayerWithDesignsForGame(gameID int64, num int) (*cs.Player, error)
	CreatePlayer(player *cs.Player) error
	UpdatePlayer(player *cs.Player) error
	SubmitPlayerTurn(gameID int64, num int, submittedTurn bool) error
	UpdatePlayerOrders(player *cs.Player) error
	UpdatePlayerRelations(player *cs.Player) error
	UpdatePlayerSpec(player *cs.Player) error
	UpdatePlayerPlans(player *cs.Player) error
	UpdatePlayerSalvageIntels(player *cs.Player) error
	UpdateLightPlayer(player *cs.Player) error
	UpdatePlayerUserId(player *cs.Player) error
	DeletePlayer(id int64) error

	GetShipDesignsForPlayer(gameID int64, playerNum int) ([]*cs.ShipDesign, error)
	GetShipDesign(id int64) (*cs.ShipDesign, error)
	GetShipDesignByNum(gameID int64, playerNum, num int) (*cs.ShipDesign, error)
	CreateShipDesign(shipDesign *cs.ShipDesign) error
	UpdateShipDesign(shipDesign *cs.ShipDesign) error
	DeleteShipDesign(id int64) error

	GetPlanet(id int64) (*cs.Planet, error)
	GetPlanetByNum(gameID int64, num int) (*cs.Planet, error)
	GetPlanetsForPlayer(gameID int64, playerNum int) ([]*cs.Planet, error)
	UpdatePlanet(planet *cs.Planet) error
	UpdatePlanetSpec(planet *cs.Planet) error

	GetFleet(id int64) (*cs.Fleet, error)
	GetFleetByNum(gameID int64, playerNum int, num int) (*cs.Fleet, error)
	GetFleetsByNums(gameID int64, playerNum int, nums []int) ([]*cs.Fleet, error)
	CreateFleet(fleet *cs.Fleet) error
	UpdateFleet(fleet *cs.Fleet) error
	CreateUpdateOrDeleteFleets(gameID int64, fleets []*cs.Fleet) error
	DeleteFleet(id int64) error
	GetFleetsForPlayer(gameID int64, playerNum int) ([]*cs.Fleet, error)
	GetFleetsOrbitingPlanet(gameID int64, planetNum int) ([]*cs.Fleet, error)

	GetMineField(id int64) (*cs.MineField, error)
	GetMineFieldsForPlayer(gameID int64, playerNum int) ([]*cs.MineField, error)
	UpdateMineField(fleet *cs.MineField) error

	GetMineralPacket(id int64) (*cs.MineralPacket, error)
	GetMineralPacketsForPlayer(gameID int64, playerNum int) ([]*cs.MineralPacket, error)

	GetSalvagesForGame(gameID int64) ([]*cs.Salvage, error)
	GetSalvagesForPlayer(gameID int64, playerNum int) ([]*cs.Salvage, error)
	GetSalvageByNum(gameID int64, num int) (*cs.Salvage, error)
	CreateSalvage(salvage *cs.Salvage) error
	UpdateSalvage(salvage *cs.Salvage) error
	// contains filtered or unexported methods
}

A database Client interface is used to make all calls that modify the database

type Converter

type Converter interface {
	// goverter:map . DBObject
	ConvertUser(source User) cs.User

	ConvertUsers(source []User) []cs.User

	// goverter:autoMap DBObject
	ConvertGameUser(source *cs.User) *User

	// goverter:map . DBObject
	// goverter:map . ResearchCost | ExtendResearchCost
	// goverter:map . HabLow | ExtendHabLow
	// goverter:map . HabHigh | ExtendHabHigh
	ConvertRace(source Race) cs.Race

	ConvertRaces(source []Race) []cs.Race

	// goverter:autoMap DBObject
	// goverter:map HabHigh.Grav HabHighGrav
	// goverter:map HabHigh.Temp HabHighTemp
	// goverter:map HabHigh.Rad HabHighRad
	// goverter:map HabLow.Grav HabLowGrav
	// goverter:map HabLow.Temp HabLowTemp
	// goverter:map HabLow.Rad HabLowRad
	// goverter:map ResearchCost.Energy ResearchCostEnergy
	// goverter:map ResearchCost.Weapons ResearchCostWeapons
	// goverter:map ResearchCost.Propulsion ResearchCostPropulsion
	// goverter:map ResearchCost.Construction ResearchCostConstruction
	// goverter:map ResearchCost.Electronics ResearchCostElectronics
	// goverter:map ResearchCost.Biotechnology ResearchCostBiotechnology
	ConvertGameRace(source *cs.Race) *Race

	// goverter:map . DBObject
	// goverter:map . VictoryConditions | ExtendVictoryConditions
	// goverter:map . Area | ExtendArea
	// goverter:map . Rules | ExtendDefaultRules
	ConvertGame(source Game) cs.Game

	ConvertGames(source []Game) []cs.Game

	// goverter:autoMap DBObject
	// goverter:map VictoryConditions.NumCriteriaRequired VictoryConditionsNumCriteriaRequired
	// goverter:map VictoryConditions.YearsPassed VictoryConditionsYearsPassed
	// goverter:map VictoryConditions.OwnPlanets VictoryConditionsOwnPlanets
	// goverter:map VictoryConditions.AttainTechLevel VictoryConditionsAttainTechLevel
	// goverter:map VictoryConditions.AttainTechLevelNumFields VictoryConditionsAttainTechLevelNumFields
	// goverter:map VictoryConditions.ExceedsScore VictoryConditionsExceedsScore
	// goverter:map VictoryConditions.ExceedsSecondPlaceScore VictoryConditionsExceedsSecondPlaceScore
	// goverter:map VictoryConditions.ProductionCapacity VictoryConditionsProductionCapacity
	// goverter:map VictoryConditions.OwnCapitalShips VictoryConditionsOwnCapitalShips
	// goverter:map VictoryConditions.HighestScoreAfterYears VictoryConditionsHighestScoreAfterYears
	// goverter:map VictoryConditions.Conditions VictoryConditionsConditions
	// goverter:map Area.X AreaX
	// goverter:map Area.Y AreaY
	ConvertGameGame(source *cs.Game) *Game

	// goverter:autoMap GameDBObject
	// goverter:map TechLevels.Energy TechLevelsEnergy
	// goverter:map TechLevels.Weapons TechLevelsWeapons
	// goverter:map TechLevels.Propulsion TechLevelsPropulsion
	// goverter:map TechLevels.Construction TechLevelsConstruction
	// goverter:map TechLevels.Electronics TechLevelsElectronics
	// goverter:map TechLevels.Biotechnology TechLevelsBiotechnology
	// goverter:map TechLevelsSpent.Energy TechLevelsSpentEnergy
	// goverter:map TechLevelsSpent.Weapons TechLevelsSpentWeapons
	// goverter:map TechLevelsSpent.Propulsion TechLevelsSpentPropulsion
	// goverter:map TechLevelsSpent.Construction TechLevelsSpentConstruction
	// goverter:map TechLevelsSpent.Electronics TechLevelsSpentElectronics
	// goverter:map TechLevelsSpent.Biotechnology TechLevelsSpentBiotechnology
	// goverter:autoMap PlayerOrders
	// goverter:map PlayerIntels.BattleRecords BattleRecords
	// goverter:map PlayerIntels.PlayerIntels PlayerIntels
	// goverter:map PlayerIntels.ScoreIntels ScoreIntels
	// goverter:map PlayerIntels.PlanetIntels PlanetIntels
	// goverter:map PlayerIntels.FleetIntels FleetIntels
	// goverter:map PlayerIntels.StarbaseIntels StarbaseIntels
	// goverter:map PlayerIntels.ShipDesignIntels ShipDesignIntels
	// goverter:map PlayerIntels.MineralPacketIntels MineralPacketIntels
	// goverter:map PlayerIntels.MineFieldIntels MineFieldIntels
	// goverter:map PlayerIntels.WormholeIntels WormholeIntels
	// goverter:map PlayerIntels.MysteryTraderIntels MysteryTraderIntels
	// goverter:map PlayerIntels.SalvageIntels	 SalvageIntels
	// goverter:autoMap PlayerPlans
	ConvertGamePlayer(source *cs.Player) *Player

	// goverter:map . GameDBObject
	// goverter:map . TechLevels | ExtendTechLevels
	// goverter:map . TechLevelsSpent | ExtendTechLevelsSpent
	// goverter:map . PlayerOrders
	// goverter:map . PlayerIntels
	// goverter:map . PlayerPlans
	// goverter:ignore Designs
	ConvertPlayer(source Player) cs.Player

	ConvertPlayers(source []Player) []cs.Player

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:autoMap PlanetOrders
	// goverter:autoMap Hab
	// goverter:map BaseHab.Grav BaseGrav
	// goverter:map BaseHab.Temp BaseTemp
	// goverter:map BaseHab.Rad BaseRad
	// goverter:map TerraformedAmount.Grav TerraformedAmountGrav
	// goverter:map TerraformedAmount.Temp TerraformedAmountTemp
	// goverter:map TerraformedAmount.Rad TerraformedAmountRad
	// goverter:map MineralConcentration.Ironium MineralConcIronium
	// goverter:map MineralConcentration.Boranium MineralConcBoranium
	// goverter:map MineralConcentration.Germanium MineralConcGermanium
	// goverter:map MineYears.Ironium MineYearsIronium
	// goverter:map MineYears.Boranium MineYearsBoranium
	// goverter:map MineYears.Germanium MineYearsGermanium
	// goverter:autoMap Cargo
	ConvertGamePlanet(source *cs.Planet) *Planet

	// goverter:map . Hab
	// goverter:map . BaseHab | ExtendBaseHab
	// goverter:map . TerraformedAmount | ExtendTerraformedAmount
	// goverter:map . MineralConcentration | ExtendMineralConcentration
	// goverter:map . MineYears | ExtendMineYears
	// goverter:map . Cargo
	// goverter:map . MapObject | ExtendPlanetMapObject
	// goverter:map . PlanetOrders
	// goverter:ignore Starbase
	ConvertPlanet(source *Planet) *cs.Planet

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:autoMap FleetOrders
	// goverter:map Heading.X HeadingX
	// goverter:map Heading.Y HeadingY
	// goverter:map PreviousPosition.X PreviousPositionX
	// goverter:map PreviousPosition.Y PreviousPositionY
	// goverter:autoMap Cargo
	ConvertGameFleet(source *cs.Fleet) *Fleet

	// goverter:map . Heading | ExtendFleetHeading
	// goverter:map . PreviousPosition | ExtendFleetPreviousPosition
	// goverter:map . Cargo
	// goverter:map . MapObject | ExtendFleetMapObject
	// goverter:map . FleetOrders | ExtendFleetFleetOrders
	ConvertFleet(source *Fleet) *cs.Fleet

	// goverter:autoMap GameDBObject
	// goverter:ignore CanDelete
	ConvertGameShipDesign(source *cs.ShipDesign) *ShipDesign
	// goverter:ignore Dirty
	// goverter:ignore Delete
	// goverter:map . GameDBObject
	ConvertShipDesign(source *ShipDesign) *cs.ShipDesign

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	ConvertGameWormhole(source *cs.Wormhole) *Wormhole

	// goverter:map . MapObject
	ConvertWormhole(source *Wormhole) *cs.Wormhole

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:map Heading.X HeadingX
	// goverter:map Heading.Y HeadingY
	ConvertGameMysteryTrader(source *cs.MysteryTrader) *MysteryTrader

	// goverter:map . MapObject | ExtendMysteryTraderMapObject
	// goverter:map . Heading | ExtendMysteryTraderHeading
	ConvertMysteryTrader(source *MysteryTrader) *cs.MysteryTrader

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:autoMap Cargo
	ConvertGameSalvage(source *cs.Salvage) *Salvage

	// goverter:map . MapObject | ExtendSalvageMapObject
	// goverter:map . Cargo
	ConvertSalvage(source *Salvage) *cs.Salvage

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:map MineFieldOrders.Detonate Detonate
	ConvertGameMineField(source *cs.MineField) *MineField

	// goverter:map . MapObject | ExtendMineFieldMapObject
	// goverter:map . MineFieldOrders
	ConvertMineField(source *MineField) *cs.MineField

	// goverter:autoMap MapObject.GameDBObject
	// goverter:autoMap MapObject.Position
	// goverter:autoMap MapObject
	// goverter:autoMap Cargo
	// goverter:map Cargo.Ironium Ironium
	// goverter:map Cargo.Boranium Boranium
	// goverter:map Cargo.Germanium Germanium
	// goverter:map Heading.X HeadingX
	// goverter:map Heading.Y HeadingY
	ConvertGameMineralPacket(source *cs.MineralPacket) *MineralPacket

	// goverter:map . MapObject | ExtendMineralPacketMapObject
	// goverter:map . Cargo
	// goverter:map . Heading | ExtendMineralPacketHeading
	ConvertMineralPacket(source *MineralPacket) *cs.MineralPacket
	// contains filtered or unexported methods
}

goverter:converter goverter:output:package github.com/sirgwain/craig-stars/db goverter:output:file ./generated.go goverter:ignoreUnexported goverter:extend TimeToTime goverter:extend NullTimeToTime goverter:extend TimeToNullTime goverter:extend NullBoolToBool goverter:extend BoolToNullBool goverter:extend RulesToGameRules goverter:extend GameRulesToRules goverter:extend TagsToGameTags goverter:extend GameTagsToTags goverter:extend RaceSpecToGameRaceSpec goverter:extend GameRaceSpecToRaceSpec goverter:extend ProductionPlansToGameProductionPlans goverter:extend GameProductionPlansToProductionPlans goverter:extend BattlePlansToGameBattlePlans goverter:extend GameBattlePlansToBattlePlans goverter:extend TransportPlansToGameTransportPlans goverter:extend GameTransportPlansToTransportPlans goverter:extend PlayerRelationshipsToGamePlayerRelationships goverter:extend GamePlayerRelationshipsToPlayerRelationships goverter:extend PlayerMessagesToGamePlayerMessages goverter:extend GamePlayerMessagesToPlayerMessages goverter:extend PlayerScoresToGamePlayerScores goverter:extend GamePlayerScoresToPlayerScores goverter:extend BattleRecordsToGameBattleRecords goverter:extend GameBattleRecordsToBattleRecords goverter:extend PlayerIntelsToGamePlayerIntels goverter:extend GamePlayerIntelsToPlayerIntels goverter:extend ScoreIntelsToGameScoreIntels goverter:extend GameScoreIntelsToScoreIntels goverter:extend PlanetIntelsToGamePlanetIntels goverter:extend GamePlanetIntelsToPlanetIntels goverter:extend FleetIntelsToGameFleetIntels goverter:extend GameFleetIntelsToFleetIntels goverter:extend ShipDesignIntelsToGameShipDesignIntels goverter:extend GameShipDesignIntelsToShipDesignIntels goverter:extend MineralPacketIntelsToGameMineralPacketIntels goverter:extend GameMineralPacketIntelsToMineralPacketIntels goverter:extend SalvageIntelsToGameSalvageIntels goverter:extend GameSalvageIntelsToSalvageIntels goverter:extend MineFieldIntelsToGameMineFieldIntels goverter:extend GameMineFieldIntelsToMineFieldIntels goverter:extend WormholeIntelsToGameWormholeIntels goverter:extend GameWormholeIntelsToWormholeIntels goverter:extend MysteryTraderIntelsToGameMysteryTraderIntels goverter:extend GameMysteryTraderIntelsToMysteryTraderIntels goverter:extend GameRaceToPlayerRace goverter:extend PlayerRaceToGameRace goverter:extend PlayerSpecToGamePlayerSpec goverter:extend GamePlayerSpecToPlayerSpec goverter:extend PlayerStatsToGamePlayerStats goverter:extend GamePlayerStatsToPlayerStats goverter:name GameConverter goverter:extend PlanetSpecToGamePlanetSpec goverter:extend GamePlanetSpecToPlanetSpec goverter:extend ProductionQueueItemsToGameProductionQueueItems goverter:extend GameProductionQueueItemsToProductionQueueItems goverter:extend FleetSpecToGameFleetSpec goverter:extend GameFleetSpecToFleetSpec goverter:extend ShipTokensToGameShipTokens goverter:extend GameShipTokensToShipTokens goverter:extend WaypointsToGameWaypoints goverter:extend GameWaypointsToWaypoints goverter:extend MineFieldSpecToGameMineFieldSpec goverter:extend GameMineFieldSpecToMineFieldSpec goverter:extend ShipDesignSpecToGameShipDesignSpec goverter:extend GameShipDesignSpecToShipDesignSpec goverter:extend ShipDesignSlotsToGameShipDesignSlots goverter:extend GameShipDesignSlotsToShipDesignSlots goverter:extend WormholeSpecToGameWormholeSpec goverter:extend GameWormholeSpecToWormholeSpec goverter:extend MysteryTraderSpecToGameMysteryTraderSpec goverter:extend GameMysteryTraderSpecToMysteryTraderSpec goverter:enum no

type DBConn

type DBConn interface {
	Connect(config *config.Config) error
	Close() error

	// create a new read client
	NewReadClient() Client
	NewReadWriteClient() Client

	// for write clients we use transactions
	BeginTransaction() (Client, error)
	Rollback(c Client) error
	Commit(c Client) error

	// wrap a function call inside a transaction
	WrapInTransaction(wrap func(c Client) error) error
}

DBConn represents a connection to the database Some database connections are read only, others are readwrite A readWrite connection can be wrapped in a transaction, but be warned, this locks the database until the transaction completes or fails.

func NewConn

func NewConn() DBConn

type Fleet

type Fleet struct {
	ID                int64           `json:"id,omitempty"`
	GameID            int64           `json:"gameId,omitempty"`
	CreatedAt         time.Time       `json:"createdAt,omitempty"`
	UpdatedAt         time.Time       `json:"updatedAt,omitempty"`
	X                 float64         `json:"x,omitempty"`
	Y                 float64         `json:"y,omitempty"`
	Name              string          `json:"name,omitempty"`
	Num               int             `json:"num,omitempty"`
	PlayerNum         int             `json:"playerNum,omitempty"`
	Tags              *Tags           `json:"tags,omitempty"`
	Tokens            *ShipTokens     `json:"tokens,omitempty"`
	Waypoints         *Waypoints      `json:"waypoints,omitempty"`
	RepeatOrders      bool            `json:"repeatOrders,omitempty"`
	PlanetNum         int             `json:"planetNum,omitempty"`
	BaseName          string          `json:"baseName,omitempty"`
	Ironium           int             `json:"ironium,omitempty"`
	Boranium          int             `json:"boranium,omitempty"`
	Germanium         int             `json:"germanium,omitempty"`
	Colonists         int             `json:"colonists,omitempty"`
	Fuel              int             `json:"fuel,omitempty"`
	Age               int             `json:"age,omitempty"`
	BattlePlanNum     int             `json:"battlePlanNum,omitempty"`
	HeadingX          float64         `json:"headingX,omitempty"`
	HeadingY          float64         `json:"headingY,omitempty"`
	WarpSpeed         int             `json:"warpSpeed,omitempty"`
	PreviousPositionX *float64        `json:"previousPositionX,omitempty"`
	PreviousPositionY *float64        `json:"previousPositionY,omitempty"`
	OrbitingPlanetNum int             `json:"orbitingPlanetNum,omitempty"`
	Starbase          bool            `json:"starbase,omitempty"`
	Purpose           cs.FleetPurpose `json:"purpose,omitempty"`
	Spec              *FleetSpec      `json:"spec,omitempty"`
}

type FleetIntels

type FleetIntels []cs.FleetIntel

func GameFleetIntelsToFleetIntels

func GameFleetIntelsToFleetIntels(source []cs.FleetIntel) *FleetIntels

func (*FleetIntels) Scan

func (item *FleetIntels) Scan(src interface{}) error

func (*FleetIntels) Value

func (item *FleetIntels) Value() (driver.Value, error)

type FleetSpec

type FleetSpec cs.FleetSpec

func GameFleetSpecToFleetSpec

func GameFleetSpecToFleetSpec(source cs.FleetSpec) *FleetSpec

func (*FleetSpec) Scan

func (item *FleetSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*FleetSpec) Value

func (item *FleetSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Game

type Game struct {
	ID                                        int64              `json:"id,omitempty"`
	CreatedAt                                 time.Time          `json:"createdAt,omitempty"`
	UpdatedAt                                 time.Time          `json:"updatedAt,omitempty"`
	HostID                                    int64              `json:"hostId,omitempty"`
	Name                                      string             `json:"name,omitempty"`
	State                                     cs.GameState       `json:"state,omitempty"`
	Public                                    bool               `json:"public,omitempty"`
	Hash                                      string             `json:"hash"`
	Size                                      cs.Size            `json:"size,omitempty"`
	Density                                   cs.Density         `json:"density,omitempty"`
	PlayerPositions                           cs.PlayerPositions `json:"playerPositions,omitempty"`
	RandomEvents                              bool               `json:"randomEvents,omitempty"`
	ComputerPlayersFormAlliances              bool               `json:"computerPlayersFormAlliances,omitempty"`
	PublicPlayerScores                        bool               `json:"publicPlayerScores,omitempty"`
	MaxMinerals                               bool               `json:"maxMinerals,omitempty"`
	AcceleratedPlay                           bool               `json:"acceleratedPlay,omitempty"`
	StartMode                                 cs.GameStartMode   `json:"startMode,omitempty"`
	QuickStartTurns                           int                `json:"quickStartTurns,omitempty"`
	OpenPlayerSlots                           int                `json:"openPlayerSlots,omitempty"`
	NumPlayers                                int                `json:"numPlayers,omitempty"`
	VictoryConditionsConditions               cs.Bitmask         `json:"victoryConditionsConditions,omitempty"`
	VictoryConditionsNumCriteriaRequired      int                `json:"victoryConditionsNumCriteriaRequired,omitempty"`
	VictoryConditionsYearsPassed              int                `json:"victoryConditionsYearsPassed,omitempty"`
	VictoryConditionsOwnPlanets               int                `json:"victoryConditionsOwnPlanets,omitempty"`
	VictoryConditionsAttainTechLevel          int                `json:"victoryConditionsAttainTechLevel,omitempty"`
	VictoryConditionsAttainTechLevelNumFields int                `json:"victoryConditionsAttainTechLevelNumFields,omitempty"`
	VictoryConditionsExceedsScore             int                `json:"victoryConditionsExceedsScore,omitempty"`
	VictoryConditionsExceedsSecondPlaceScore  int                `json:"victoryConditionsExceedsSecondPlaceScore,omitempty"`
	VictoryConditionsProductionCapacity       int                `json:"victoryConditionsProductionCapacity,omitempty"`
	VictoryConditionsOwnCapitalShips          int                `json:"victoryConditionsOwnCapitalShips,omitempty"`
	VictoryConditionsHighestScoreAfterYears   int                `json:"victoryConditionsHighestScoreAfterYears,omitempty"`
	Seed                                      int64              `json:"seed,omitempty"`
	Rules                                     *Rules             `json:"rules,omitempty"`
	AreaX                                     float64            `json:"areaX,omitempty"`
	AreaY                                     float64            `json:"areaY,omitempty"`
	Year                                      int                `json:"year,omitempty"`
	VictorDeclared                            bool               `json:"victorDeclared,omitempty"`
}

type GameConverter

type GameConverter struct{}

func (*GameConverter) ConvertFleet

func (c *GameConverter) ConvertFleet(source *Fleet) *cs.Fleet

func (*GameConverter) ConvertGame

func (c *GameConverter) ConvertGame(source Game) cs.Game

func (*GameConverter) ConvertGameFleet

func (c *GameConverter) ConvertGameFleet(source *cs.Fleet) *Fleet

func (*GameConverter) ConvertGameGame

func (c *GameConverter) ConvertGameGame(source *cs.Game) *Game

func (*GameConverter) ConvertGameMineField

func (c *GameConverter) ConvertGameMineField(source *cs.MineField) *MineField

func (*GameConverter) ConvertGameMineralPacket

func (c *GameConverter) ConvertGameMineralPacket(source *cs.MineralPacket) *MineralPacket

func (*GameConverter) ConvertGameMysteryTrader

func (c *GameConverter) ConvertGameMysteryTrader(source *cs.MysteryTrader) *MysteryTrader

func (*GameConverter) ConvertGamePlanet

func (c *GameConverter) ConvertGamePlanet(source *cs.Planet) *Planet

func (*GameConverter) ConvertGamePlayer

func (c *GameConverter) ConvertGamePlayer(source *cs.Player) *Player

func (*GameConverter) ConvertGameRace

func (c *GameConverter) ConvertGameRace(source *cs.Race) *Race

func (*GameConverter) ConvertGameSalvage

func (c *GameConverter) ConvertGameSalvage(source *cs.Salvage) *Salvage

func (*GameConverter) ConvertGameShipDesign

func (c *GameConverter) ConvertGameShipDesign(source *cs.ShipDesign) *ShipDesign

func (*GameConverter) ConvertGameUser

func (c *GameConverter) ConvertGameUser(source *cs.User) *User

func (*GameConverter) ConvertGameWormhole

func (c *GameConverter) ConvertGameWormhole(source *cs.Wormhole) *Wormhole

func (*GameConverter) ConvertGames

func (c *GameConverter) ConvertGames(source []Game) []cs.Game

func (*GameConverter) ConvertMineField

func (c *GameConverter) ConvertMineField(source *MineField) *cs.MineField

func (*GameConverter) ConvertMineralPacket

func (c *GameConverter) ConvertMineralPacket(source *MineralPacket) *cs.MineralPacket

func (*GameConverter) ConvertMysteryTrader

func (c *GameConverter) ConvertMysteryTrader(source *MysteryTrader) *cs.MysteryTrader

func (*GameConverter) ConvertPlanet

func (c *GameConverter) ConvertPlanet(source *Planet) *cs.Planet

func (*GameConverter) ConvertPlayer

func (c *GameConverter) ConvertPlayer(source Player) cs.Player

func (*GameConverter) ConvertPlayers

func (c *GameConverter) ConvertPlayers(source []Player) []cs.Player

func (*GameConverter) ConvertRace

func (c *GameConverter) ConvertRace(source Race) cs.Race

func (*GameConverter) ConvertRaces

func (c *GameConverter) ConvertRaces(source []Race) []cs.Race

func (*GameConverter) ConvertSalvage

func (c *GameConverter) ConvertSalvage(source *Salvage) *cs.Salvage

func (*GameConverter) ConvertShipDesign

func (c *GameConverter) ConvertShipDesign(source *ShipDesign) *cs.ShipDesign

func (*GameConverter) ConvertUser

func (c *GameConverter) ConvertUser(source User) cs.User

func (*GameConverter) ConvertUsers

func (c *GameConverter) ConvertUsers(source []User) []cs.User

func (*GameConverter) ConvertWormhole

func (c *GameConverter) ConvertWormhole(source *Wormhole) *cs.Wormhole

type MineField

type MineField struct {
	ID            int64            `json:"id,omitempty"`
	GameID        int64            `json:"gameId,omitempty"`
	CreatedAt     time.Time        `json:"createdAt,omitempty"`
	UpdatedAt     time.Time        `json:"updatedAt,omitempty"`
	X             float64          `json:"x,omitempty"`
	Y             float64          `json:"y,omitempty"`
	Name          string           `json:"name,omitempty"`
	Num           int              `json:"num,omitempty"`
	PlayerNum     int              `json:"playerNum,omitempty"`
	Tags          *Tags            `json:"tags,omitempty"`
	MineFieldType cs.MineFieldType `json:"mineFieldType,omitempty"`
	NumMines      int              `json:"numMines,omitempty"`
	Detonate      bool             `json:"detonate,omitempty"`
	Spec          *MineFieldSpec   `json:"spec,omitempty"`
}

type MineFieldIntels

type MineFieldIntels []cs.MineFieldIntel

func GameMineFieldIntelsToMineFieldIntels

func GameMineFieldIntelsToMineFieldIntels(source []cs.MineFieldIntel) *MineFieldIntels

func (*MineFieldIntels) Scan

func (item *MineFieldIntels) Scan(src interface{}) error

func (*MineFieldIntels) Value

func (item *MineFieldIntels) Value() (driver.Value, error)

type MineFieldSpec

type MineFieldSpec cs.MineFieldSpec

func GameMineFieldSpecToMineFieldSpec

func GameMineFieldSpecToMineFieldSpec(source cs.MineFieldSpec) *MineFieldSpec

func (*MineFieldSpec) Scan

func (item *MineFieldSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*MineFieldSpec) Value

func (item *MineFieldSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type MineralPacket

type MineralPacket struct {
	ID              int64     `json:"id,omitempty"`
	GameID          int64     `json:"gameId,omitempty"`
	CreatedAt       time.Time `json:"createdAt,omitempty"`
	UpdatedAt       time.Time `json:"updatedAt,omitempty"`
	X               float64   `json:"x,omitempty"`
	Y               float64   `json:"y,omitempty"`
	Name            string    `json:"name,omitempty"`
	Num             int       `json:"num,omitempty"`
	PlayerNum       int       `json:"playerNum,omitempty"`
	Tags            *Tags     `json:"tags,omitempty"`
	TargetPlanetNum int       `json:"targetPlanetNum,omitempty"`
	Ironium         int       `json:"ironium,omitempty"`
	Boranium        int       `json:"boranium,omitempty"`
	Germanium       int       `json:"germanium,omitempty"`
	SafeWarpSpeed   int       `json:"safeWarpSpeed,omitempty"`
	WarpSpeed       int       `json:"warpSpeed,omitempty"`
	ScanRange       int       `json:"scanRange,omitempty"`
	ScanRangePen    int       `json:"scanRangePen,omitempty"`
	HeadingX        float64   `json:"headingX,omitempty"`
	HeadingY        float64   `json:"headingY,omitempty"`
}

type MineralPacketIntels

type MineralPacketIntels []cs.MineralPacketIntel

func GameMineralPacketIntelsToMineralPacketIntels

func GameMineralPacketIntelsToMineralPacketIntels(source []cs.MineralPacketIntel) *MineralPacketIntels

func (*MineralPacketIntels) Scan

func (item *MineralPacketIntels) Scan(src interface{}) error

func (*MineralPacketIntels) Value

func (item *MineralPacketIntels) Value() (driver.Value, error)

type MysteryTrader

type MysteryTrader struct {
	ID        int64              `json:"id,omitempty"`
	GameID    int64              `json:"gameId,omitempty"`
	CreatedAt time.Time          `json:"createdAt,omitempty"`
	UpdatedAt time.Time          `json:"updatedAt,omitempty"`
	X         float64            `json:"x,omitempty"`
	Y         float64            `json:"y,omitempty"`
	Name      string             `json:"name,omitempty"`
	Num       int                `json:"num,omitempty"`
	Tags      *Tags              `json:"tags,omitempty"`
	HeadingX  float64            `json:"headingX,omitempty"`
	HeadingY  float64            `json:"headingY,omitempty"`
	WarpSpeed int                `json:"warpSpeed,omitempty"`
	Spec      *MysteryTraderSpec `json:"spec,omitempty"`
}

type MysteryTraderIntels

type MysteryTraderIntels []cs.MysteryTraderIntel

func GameMysteryTraderIntelsToMysteryTraderIntels

func GameMysteryTraderIntelsToMysteryTraderIntels(source []cs.MysteryTraderIntel) *MysteryTraderIntels

func (*MysteryTraderIntels) Scan

func (item *MysteryTraderIntels) Scan(src interface{}) error

func (*MysteryTraderIntels) Value

func (item *MysteryTraderIntels) Value() (driver.Value, error)

type MysteryTraderSpec

type MysteryTraderSpec cs.MysteryTraderSpec

we json serialize these types with custom Scan/Value methods

func GameMysteryTraderSpecToMysteryTraderSpec

func GameMysteryTraderSpecToMysteryTraderSpec(source cs.MysteryTraderSpec) *MysteryTraderSpec

func (*MysteryTraderSpec) Scan

func (item *MysteryTraderSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*MysteryTraderSpec) Value

func (item *MysteryTraderSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Planet

type Planet struct {
	ID                                int64                 `json:"id,omitempty"`
	GameID                            int64                 `json:"gameId,omitempty"`
	CreatedAt                         time.Time             `json:"createdAt,omitempty"`
	UpdatedAt                         time.Time             `json:"updatedAt,omitempty"`
	X                                 float64               `json:"x,omitempty"`
	Y                                 float64               `json:"y,omitempty"`
	Name                              string                `json:"name,omitempty"`
	Num                               int                   `json:"num,omitempty"`
	PlayerNum                         int                   `json:"playerNum,omitempty"`
	Tags                              *Tags                 `json:"tags,omitempty"`
	Grav                              int                   `json:"grav,omitempty"`
	Temp                              int                   `json:"temp,omitempty"`
	Rad                               int                   `json:"rad,omitempty"`
	BaseGrav                          int                   `json:"baseGrav,omitempty"`
	BaseTemp                          int                   `json:"baseTemp,omitempty"`
	BaseRad                           int                   `json:"baseRad,omitempty"`
	TerraformedAmountGrav             int                   `json:"terraformedAmountGrav,omitempty"`
	TerraformedAmountTemp             int                   `json:"terraformedAmountTemp,omitempty"`
	TerraformedAmountRad              int                   `json:"terraformedAmountRad,omitempty"`
	MineralConcIronium                int                   `json:"mineralConcIronium,omitempty"`
	MineralConcBoranium               int                   `json:"mineralConcBoranium,omitempty"`
	MineralConcGermanium              int                   `json:"mineralConcGermanium,omitempty"`
	MineYearsIronium                  int                   `json:"mineYearsIronium,omitempty"`
	MineYearsBoranium                 int                   `json:"mineYearsBoranium,omitempty"`
	MineYearsGermanium                int                   `json:"mineYearsGermanium,omitempty"`
	Ironium                           int                   `json:"ironium,omitempty"`
	Boranium                          int                   `json:"boranium,omitempty"`
	Germanium                         int                   `json:"germanium,omitempty"`
	Colonists                         int                   `json:"colonists,omitempty"`
	Mines                             int                   `json:"mines,omitempty"`
	Factories                         int                   `json:"factories,omitempty"`
	Defenses                          int                   `json:"defenses,omitempty"`
	Homeworld                         bool                  `json:"homeworld,omitempty"`
	ContributesOnlyLeftoverToResearch bool                  `json:"contributesOnlyLeftoverToResearch,omitempty"`
	Scanner                           bool                  `json:"scanner,omitempty"`
	RouteTargetType                   cs.MapObjectType      `json:"routeTargetType,omitempty"`
	RouteTargetNum                    int                   `json:"routeTargetNum,omitempty"`
	RouteTargetPlayerNum              int                   `json:"routeTargetPlayerNum,omitempty"`
	PacketTargetNum                   int                   `json:"packetTargetNum,omitempty"`
	PacketSpeed                       int                   `json:"packetSpeed,omitempty"`
	RandomArtifact                    bool                  `json:"randomArtifact,omitempty"`
	ProductionQueue                   *ProductionQueueItems `json:"productionQueue,omitempty"`
	Spec                              *PlanetSpec           `json:"spec,omitempty"`
}

type PlanetIntels

type PlanetIntels []cs.PlanetIntel

func GamePlanetIntelsToPlanetIntels

func GamePlanetIntelsToPlanetIntels(source []cs.PlanetIntel) *PlanetIntels

func (*PlanetIntels) Scan

func (item *PlanetIntels) Scan(src interface{}) error

func (*PlanetIntels) Value

func (item *PlanetIntels) Value() (driver.Value, error)

type PlanetSpec

type PlanetSpec cs.PlanetSpec

func GamePlanetSpecToPlanetSpec

func GamePlanetSpecToPlanetSpec(source cs.PlanetSpec) *PlanetSpec

func (*PlanetSpec) Scan

func (item *PlanetSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*PlanetSpec) Value

func (item *PlanetSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Player

type Player struct {
	ID                           int64                `json:"id,omitempty"`
	CreatedAt                    time.Time            `json:"createdAt,omitempty"`
	UpdatedAt                    time.Time            `json:"updatedAt,omitempty"`
	GameID                       int64                `json:"gameId,omitempty"`
	UserID                       int64                `json:"userId,omitempty"`
	Name                         string               `json:"name,omitempty"`
	Num                          int                  `json:"num,omitempty"`
	Ready                        bool                 `json:"ready,omitempty"`
	AIControlled                 bool                 `json:"aiControlled,omitempty"`
	Guest                        bool                 `json:"guest,omitempty"`
	SubmittedTurn                bool                 `json:"submittedTurn,omitempty"`
	Color                        string               `json:"color,omitempty"`
	DefaultHullSet               int                  `json:"defaultHullSet,omitempty"`
	TechLevelsEnergy             int                  `json:"techLevelsEnergy,omitempty"`
	TechLevelsWeapons            int                  `json:"techLevelsWeapons,omitempty"`
	TechLevelsPropulsion         int                  `json:"techLevelsPropulsion,omitempty"`
	TechLevelsConstruction       int                  `json:"techLevelsConstruction,omitempty"`
	TechLevelsElectronics        int                  `json:"techLevelsElectronics,omitempty"`
	TechLevelsBiotechnology      int                  `json:"techLevelsBiotechnology,omitempty"`
	TechLevelsSpentEnergy        int                  `json:"techLevelsSpentEnergy,omitempty"`
	TechLevelsSpentWeapons       int                  `json:"techLevelsSpentWeapons,omitempty"`
	TechLevelsSpentPropulsion    int                  `json:"techLevelsSpentPropulsion,omitempty"`
	TechLevelsSpentConstruction  int                  `json:"techLevelsSpentConstruction,omitempty"`
	TechLevelsSpentElectronics   int                  `json:"techLevelsSpentElectronics,omitempty"`
	TechLevelsSpentBiotechnology int                  `json:"techLevelsSpentBiotechnology,omitempty"`
	ResearchAmount               int                  `json:"researchAmount,omitempty"`
	ResearchSpentLastYear        int                  `json:"researchSpentLastYear,omitempty"`
	NextResearchField            cs.NextResearchField `json:"nextResearchField,omitempty"`
	Researching                  cs.TechField         `json:"researching,omitempty"`
	BattlePlans                  *BattlePlans         `json:"battlePlans,omitempty"`
	ProductionPlans              *ProductionPlans     `json:"productionPlans,omitempty"`
	TransportPlans               *TransportPlans      `json:"transportPlans,omitempty"`
	Relations                    *PlayerRelationships `json:"relations,omitempty"`
	Messages                     *PlayerMessages      `json:"messages,omitempty"`
	BattleRecords                *BattleRecords       `json:"battleRecords,omitempty"`
	PlayerIntels                 *PlayerIntels        `json:"playerIntels,omitempty"`
	ScoreIntels                  *ScoreIntels         `json:"scoreIntels,omitempty"`
	PlanetIntels                 *PlanetIntels        `json:"planetIntels,omitempty"`
	FleetIntels                  *FleetIntels         `json:"fleetIntels,omitempty"`
	StarbaseIntels               *FleetIntels         `json:"starbaseIntels,omitempty"`
	ShipDesignIntels             *ShipDesignIntels    `json:"shipDesignIntels,omitempty"`
	MineralPacketIntels          *MineralPacketIntels `json:"mineralPacketIntels,omitempty"`
	MineFieldIntels              *MineFieldIntels     `json:"mineFieldIntels,omitempty"`
	WormholeIntels               *WormholeIntels      `json:"wormholeIntels,omitempty"`
	MysteryTraderIntels          *MysteryTraderIntels `json:"mysteryTraderIntels,omitempty"`
	SalvageIntels                *SalvageIntels       `json:"salvageIntels,omitempty"`
	Race                         *PlayerRace          `json:"race,omitempty"`
	Stats                        *PlayerStats         `json:"stats,omitempty"`
	ScoreHistory                 *PlayerScores        `json:"scoreHistory,omitempty"`
	AchievedVictoryConditions    cs.Bitmask           `json:"achievedVictoryConditions,omitempty"`
	Victor                       bool                 `json:"victor,omitempty"`
	Spec                         *PlayerSpec          `json:"spec,omitempty"`
}

type PlayerIntels

type PlayerIntels []cs.PlayerIntel

func GamePlayerIntelsToPlayerIntels

func GamePlayerIntelsToPlayerIntels(source []cs.PlayerIntel) *PlayerIntels

func (*PlayerIntels) Scan

func (item *PlayerIntels) Scan(src interface{}) error

func (*PlayerIntels) Value

func (item *PlayerIntels) Value() (driver.Value, error)

type PlayerMessages

type PlayerMessages []cs.PlayerMessage

func GamePlayerMessagesToPlayerMessages

func GamePlayerMessagesToPlayerMessages(source []cs.PlayerMessage) *PlayerMessages

func (*PlayerMessages) Scan

func (item *PlayerMessages) Scan(src interface{}) error

func (*PlayerMessages) Value

func (item *PlayerMessages) Value() (driver.Value, error)

type PlayerRace

type PlayerRace cs.Race

func GameRaceToPlayerRace

func GameRaceToPlayerRace(source cs.Race) *PlayerRace

func (*PlayerRace) Scan

func (item *PlayerRace) Scan(src interface{}) error

db deserializer to read this from JSON

func (*PlayerRace) Value

func (item *PlayerRace) Value() (driver.Value, error)

db serializer to serialize this to JSON

type PlayerRelationships

type PlayerRelationships []cs.PlayerRelationship

func GamePlayerRelationshipsToPlayerRelationships

func GamePlayerRelationshipsToPlayerRelationships(source []cs.PlayerRelationship) *PlayerRelationships

func (*PlayerRelationships) Scan

func (item *PlayerRelationships) Scan(src interface{}) error

func (*PlayerRelationships) Value

func (item *PlayerRelationships) Value() (driver.Value, error)

type PlayerScores

type PlayerScores []cs.PlayerScore

func GamePlayerScoresToPlayerScores

func GamePlayerScoresToPlayerScores(source []cs.PlayerScore) *PlayerScores

func (*PlayerScores) Scan

func (item *PlayerScores) Scan(src interface{}) error

func (*PlayerScores) Value

func (item *PlayerScores) Value() (driver.Value, error)

type PlayerSpec

type PlayerSpec cs.PlayerSpec

func GamePlayerSpecToPlayerSpec

func GamePlayerSpecToPlayerSpec(source cs.PlayerSpec) *PlayerSpec

func (*PlayerSpec) Scan

func (item *PlayerSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*PlayerSpec) Value

func (item *PlayerSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type PlayerStats

type PlayerStats cs.PlayerStats

func GamePlayerStatsToPlayerStats

func GamePlayerStatsToPlayerStats(source *cs.PlayerStats) *PlayerStats

func (*PlayerStats) Scan

func (item *PlayerStats) Scan(src interface{}) error

db deserializer to read this from JSON

func (*PlayerStats) Value

func (item *PlayerStats) Value() (driver.Value, error)

db serializer to serialize this to JSON

type PlayerStatus

type PlayerStatus struct {
	UpdatedAt     time.Time `json:"updatedAt,omitempty"`
	UserID        int64     `json:"userId,omitempty"`
	Name          string    `json:"name,omitempty"`
	Num           int       `json:"num,omitempty"`
	Ready         bool      `json:"ready,omitempty"`
	AIControlled  bool      `json:"aiControlled,omitempty"`
	Guest         bool      `json:"guest,omitempty"`
	SubmittedTurn bool      `json:"submittedTurn,omitempty"`
	Color         string    `json:"color,omitempty"`
	Victor        bool      `json:"victor,omitempty"`
}

type ProductionPlans

type ProductionPlans []cs.ProductionPlan

func GameProductionPlansToProductionPlans

func GameProductionPlansToProductionPlans(source []cs.ProductionPlan) *ProductionPlans

func (*ProductionPlans) Scan

func (item *ProductionPlans) Scan(src interface{}) error

db deserializer to read this from JSON

func (*ProductionPlans) Value

func (item *ProductionPlans) Value() (driver.Value, error)

db serializer to serialize this to JSON

type ProductionQueueItems

type ProductionQueueItems []cs.ProductionQueueItem

we json serialize these types with custom Scan/Value methods

func GameProductionQueueItemsToProductionQueueItems

func GameProductionQueueItemsToProductionQueueItems(source []cs.ProductionQueueItem) *ProductionQueueItems

func (*ProductionQueueItems) Scan

func (item *ProductionQueueItems) Scan(src interface{}) error

db deserializer to read this from JSON

func (*ProductionQueueItems) Value

func (item *ProductionQueueItems) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Race

type Race struct {
	ID                        int64                    `json:"id,omitempty"`
	CreatedAt                 time.Time                `json:"createdAt,omitempty"`
	UpdatedAt                 time.Time                `json:"updatedAt,omitempty"`
	UserID                    int64                    `json:"userId,omitempty"`
	Name                      string                   `json:"name,omitempty"`
	PluralName                string                   `json:"pluralName,omitempty"`
	SpendLeftoverPointsOn     cs.SpendLeftoverPointsOn `json:"spendLeftoverPointsOn,omitempty"`
	PRT                       cs.PRT                   `json:"prt,omitempty"`
	LRTs                      cs.Bitmask               `json:"lrts,omitempty"`
	HabLowGrav                int                      `json:"habLowGrav,omitempty"`
	HabLowTemp                int                      `json:"habLowTemp,omitempty"`
	HabLowRad                 int                      `json:"habLowRad,omitempty"`
	HabHighGrav               int                      `json:"habHighGrav,omitempty"`
	HabHighTemp               int                      `json:"habHighTemp,omitempty"`
	HabHighRad                int                      `json:"habHighRad,omitempty"`
	GrowthRate                int                      `json:"growthRate,omitempty"`
	PopEfficiency             int                      `json:"popEfficiency,omitempty"`
	FactoryOutput             int                      `json:"factoryOutput,omitempty"`
	FactoryCost               int                      `json:"factoryCost,omitempty"`
	NumFactories              int                      `json:"numFactories,omitempty"`
	FactoriesCostLess         bool                     `json:"factoriesCostLess,omitempty"`
	ImmuneGrav                bool                     `json:"immuneGrav,omitempty"`
	ImmuneTemp                bool                     `json:"immuneTemp,omitempty"`
	ImmuneRad                 bool                     `json:"immuneRad,omitempty"`
	MineOutput                int                      `json:"mineOutput,omitempty"`
	MineCost                  int                      `json:"mineCost,omitempty"`
	NumMines                  int                      `json:"numMines,omitempty"`
	ResearchCostEnergy        cs.ResearchCostLevel     `json:"researchCostEnergy,omitempty"`
	ResearchCostWeapons       cs.ResearchCostLevel     `json:"researchCostWeapons,omitempty"`
	ResearchCostPropulsion    cs.ResearchCostLevel     `json:"researchCostPropulsion,omitempty"`
	ResearchCostConstruction  cs.ResearchCostLevel     `json:"researchCostConstruction,omitempty"`
	ResearchCostElectronics   cs.ResearchCostLevel     `json:"researchCostElectronics,omitempty"`
	ResearchCostBiotechnology cs.ResearchCostLevel     `json:"researchCostBiotechnology,omitempty"`
	TechsStartHigh            bool                     `json:"techsStartHigh,omitempty"`
	Spec                      *RaceSpec                `json:"spec,omitempty"`
}

type RaceSpec

type RaceSpec cs.RaceSpec

we json serialize these types with custom Scan/Value methods

func GameRaceSpecToRaceSpec

func GameRaceSpecToRaceSpec(source cs.RaceSpec) *RaceSpec

func (*RaceSpec) Scan

func (item *RaceSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*RaceSpec) Value

func (item *RaceSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Rules

type Rules cs.Rules

we json serialize these types with custom Scan/Value methods

func GameRulesToRules

func GameRulesToRules(source cs.Rules) *Rules

func (*Rules) Scan

func (item *Rules) Scan(src interface{}) error

db deserializer to read this from JSON

func (*Rules) Value

func (item *Rules) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Salvage

type Salvage struct {
	ID        int64     `json:"id,omitempty"`
	GameID    int64     `json:"gameId,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	X         float64   `json:"x,omitempty"`
	Y         float64   `json:"y,omitempty"`
	Name      string    `json:"name,omitempty"`
	Num       int       `json:"num,omitempty"`
	PlayerNum int       `json:"playerNum,omitempty"`
	Tags      *Tags     `json:"tags,omitempty"`
	Ironium   int       `json:"ironium,omitempty"`
	Boranium  int       `json:"boranium,omitempty"`
	Germanium int       `json:"germanium,omitempty"`
}

type SalvageIntels

type SalvageIntels []cs.SalvageIntel

func GameSalvageIntelsToSalvageIntels

func GameSalvageIntelsToSalvageIntels(source []cs.SalvageIntel) *SalvageIntels

func (*SalvageIntels) Scan

func (item *SalvageIntels) Scan(src interface{}) error

func (*SalvageIntels) Value

func (item *SalvageIntels) Value() (driver.Value, error)

type ScoreIntels

type ScoreIntels []cs.ScoreIntel

func GameScoreIntelsToScoreIntels

func GameScoreIntelsToScoreIntels(source []cs.ScoreIntel) *ScoreIntels

func (*ScoreIntels) Scan

func (item *ScoreIntels) Scan(src interface{}) error

func (*ScoreIntels) Value

func (item *ScoreIntels) Value() (driver.Value, error)

type ShipDesign

type ShipDesign struct {
	ID                int64                `json:"id,omitempty"`
	GameID            int64                `json:"gameId,omitempty"`
	UpdatedAt         sql.NullTime         `json:"updatedAt,omitempty"`
	CreatedAt         sql.NullTime         `json:"createdAt,omitempty"`
	Num               int                  `json:"num,omitempty"`
	PlayerNum         int                  `json:"playerNum,omitempty"`
	OriginalPlayerNum int                  `json:"originalPlayerNum,omitempty"`
	Name              string               `json:"name,omitempty"`
	Version           int                  `json:"version,omitempty"`
	Hull              string               `json:"hull,omitempty"`
	HullSetNumber     int                  `json:"hullSetNumber,omitempty"`
	CannotDelete      bool                 `json:"cannotDelete,omitempty"`
	Slots             *ShipDesignSlots     `json:"slots,omitempty"`
	Purpose           cs.ShipDesignPurpose `json:"purpose,omitempty"`
	Spec              *ShipDesignSpec      `json:"spec,omitempty"`
	CanDelete         sql.NullBool         `json:"canDelete,omitempty"` // unused
}

type ShipDesignIntels

type ShipDesignIntels []cs.ShipDesignIntel

func GameShipDesignIntelsToShipDesignIntels

func GameShipDesignIntelsToShipDesignIntels(source []cs.ShipDesignIntel) *ShipDesignIntels

func (*ShipDesignIntels) Scan

func (item *ShipDesignIntels) Scan(src interface{}) error

func (*ShipDesignIntels) Value

func (item *ShipDesignIntels) Value() (driver.Value, error)

type ShipDesignSlots

type ShipDesignSlots []cs.ShipDesignSlot

func GameShipDesignSlotsToShipDesignSlots

func GameShipDesignSlotsToShipDesignSlots(source []cs.ShipDesignSlot) *ShipDesignSlots

func (*ShipDesignSlots) Scan

func (item *ShipDesignSlots) Scan(src interface{}) error

db deserializer to read this from JSON

func (*ShipDesignSlots) Value

func (item *ShipDesignSlots) Value() (driver.Value, error)

db serializer to serialize this to JSON

type ShipDesignSpec

type ShipDesignSpec cs.ShipDesignSpec

func GameShipDesignSpecToShipDesignSpec

func GameShipDesignSpecToShipDesignSpec(source cs.ShipDesignSpec) *ShipDesignSpec

func (*ShipDesignSpec) Scan

func (item *ShipDesignSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*ShipDesignSpec) Value

func (item *ShipDesignSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

type ShipTokens

type ShipTokens []cs.ShipToken

we json serialize these types with custom Scan/Value methods

func GameShipTokensToShipTokens

func GameShipTokensToShipTokens(source []cs.ShipToken) *ShipTokens

func (*ShipTokens) Scan

func (item *ShipTokens) Scan(src interface{}) error

db deserializer to read this from JSON

func (*ShipTokens) Value

func (item *ShipTokens) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Tags

type Tags cs.Tags

func GameTagsToTags

func GameTagsToTags(source cs.Tags) *Tags

func (*Tags) Scan

func (item *Tags) Scan(src interface{}) error

db deserializer to read this from JSON

func (*Tags) Value

func (item *Tags) Value() (driver.Value, error)

db serializer to serialize this to JSON

type TransportPlans

type TransportPlans []cs.TransportPlan

func GameTransportPlansToTransportPlans

func GameTransportPlansToTransportPlans(source []cs.TransportPlan) *TransportPlans

func (*TransportPlans) Scan

func (item *TransportPlans) Scan(src interface{}) error

db deserializer to read this from JSON

func (*TransportPlans) Value

func (item *TransportPlans) Value() (driver.Value, error)

db serializer to serialize this to JSON

type User

type User struct {
	ID            int64       `json:"id" header:"ID"`
	CreatedAt     time.Time   `json:"createdAt"`
	UpdatedAt     time.Time   `json:"updatedAt"`
	GameID        int64       `json:"gameId,omitempty"`
	PlayerNum     int         `json:"playerNum,omitempty"`
	Username      string      `json:"username" header:"Username"`
	Password      string      `json:"password"`
	Email         string      `json:"email"`
	Role          cs.UserRole `json:"role"`
	Banned        bool        `json:"banned"`
	Verified      bool        `json:"verified"`
	LastLogin     *time.Time  `json:"lastLogin,omitempty"`
	DiscordID     *string     `json:"discordId,omitempty"`
	DiscordAvatar *string     `json:"discordAvatar,omitempty"`
}

type Version

type Version struct {
	ID        int64     `json:"id,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	Current   int       `json:"current,omitempty"`
}

type Waypoints

type Waypoints []cs.Waypoint

func GameWaypointsToWaypoints

func GameWaypointsToWaypoints(source []cs.Waypoint) *Waypoints

func (*Waypoints) Scan

func (item *Waypoints) Scan(src interface{}) error

db deserializer to read this from JSON

func (*Waypoints) Value

func (item *Waypoints) Value() (driver.Value, error)

db serializer to serialize this to JSON

type Wormhole

type Wormhole struct {
	ID               int64                `json:"id,omitempty"`
	GameID           int64                `json:"gameId,omitempty"`
	CreatedAt        time.Time            `json:"createdAt,omitempty"`
	UpdatedAt        time.Time            `json:"updatedAt,omitempty"`
	X                float64              `json:"x,omitempty"`
	Y                float64              `json:"y,omitempty"`
	Name             string               `json:"name,omitempty"`
	Num              int                  `json:"num,omitempty"`
	Tags             *Tags                `json:"tags,omitempty"`
	DestinationNum   int                  `json:"destinationNum,omitempty"`
	Stability        cs.WormholeStability `json:"stability,omitempty"`
	YearsAtStability int                  `json:"yearsAtStability,omitempty"`
	Spec             *WormholeSpec        `json:"spec,omitempty"`
}

type WormholeIntels

type WormholeIntels []cs.WormholeIntel

func GameWormholeIntelsToWormholeIntels

func GameWormholeIntelsToWormholeIntels(source []cs.WormholeIntel) *WormholeIntels

func (*WormholeIntels) Scan

func (item *WormholeIntels) Scan(src interface{}) error

func (*WormholeIntels) Value

func (item *WormholeIntels) Value() (driver.Value, error)

type WormholeSpec

type WormholeSpec cs.WormholeSpec

we json serialize these types with custom Scan/Value methods

func GameWormholeSpecToWormholeSpec

func GameWormholeSpecToWormholeSpec(source cs.WormholeSpec) *WormholeSpec

func (*WormholeSpec) Scan

func (item *WormholeSpec) Scan(src interface{}) error

db deserializer to read this from JSON

func (*WormholeSpec) Value

func (item *WormholeSpec) Value() (driver.Value, error)

db serializer to serialize this to JSON

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL