database

package
v0.0.0-...-1f465fc Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBuildingsString

func InitBuildingsString(buildingID []string) string

Types

type CalcResourcesModel

type CalcResourcesModel struct {
	DB        *sqlx.DB
	Resources []models.Resources
	Workers   []models.Workers
}

func (*CalcResourcesModel) CalculateResources

func (a *CalcResourcesModel) CalculateResources() error

func (*CalcResourcesModel) GetVillageSetupFromActivePlayers

func (a *CalcResourcesModel) GetVillageSetupFromActivePlayers(playerIDs []uint32, resource []models.Resources) error

type PlayerModel

type PlayerModel struct {
	DB *sqlx.DB
}

func (*PlayerModel) Delete

func (m *PlayerModel) Delete(pID uint32) error

func (*PlayerModel) Get

func (m *PlayerModel) Get(pID uint32) (*models.Player, error)

func (*PlayerModel) Insert

func (m *PlayerModel) Insert(newPlayer models.Player) (uint32, error)

type TrainingQueueModel

type TrainingQueueModel struct {
	DB        *sqlx.DB
	Resources []models.Resources
	Workers   []models.Workers
}

func (*TrainingQueueModel) Insert

func (m *TrainingQueueModel) Insert(newworkers models.TrainingQueue) (uint32, error)

func (*TrainingQueueModel) SetTrainingToDone

func (m *TrainingQueueModel) SetTrainingToDone() error

func (*TrainingQueueModel) StartTrainingNewWorker

func (m *TrainingQueueModel) StartTrainingNewWorker(trainingQueue models.TrainingQueue) error

Main function

func (*TrainingQueueModel) UpdateTrainingQueue

func (m *TrainingQueueModel) UpdateTrainingQueue() ([]models.BuildingRowAndVillage, error)

TODO Create new function to keep track of the progress of the workers queue

type VillageModel

type VillageModel struct {
	DB *sqlx.DB
}

func (*VillageModel) Insert

func (m *VillageModel) Insert(newVillage models.Village) (uint32, error)

type VillageResourcesModel

type VillageResourcesModel struct {
	DB *sqlx.DB
}

func (*VillageResourcesModel) Insert

func (m *VillageResourcesModel) Insert(newPlayerResources models.VillageResource) (uint32, error)

type VillageSetupModel

type VillageSetupModel struct {
	DB      *sqlx.DB
	Workers []models.Workers
}

func (*VillageSetupModel) GetBuildingCount

func (m *VillageSetupModel) GetBuildingCount(villageID uint32) (string, error)

func (*VillageSetupModel) Insert

func (m *VillageSetupModel) Insert(newVillageSetup models.VillageSetup) (uint32, error)

func (*VillageSetupModel) InsertWithIDCheck

func (m *VillageSetupModel) InsertWithIDCheck(village_id uint32, player_id uint32) (uint32, error)

func (*VillageSetupModel) Update

func (m *VillageSetupModel) Update(newVillageSetup models.VillageSetup) (uint32, error)

func (*VillageSetupModel) UpdateBuildingString

func (m *VillageSetupModel) UpdateBuildingString(bString string, brv models.BuildingRowAndVillage) (bool, error)

Jump to

Keyboard shortcuts

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