wikibattles

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Battle

type Battle struct {
	ID                  int    `validate:"required,min=1"`
	URL                 string `validate:"required,url"`
	Name                string `validate:"required"`
	PartOf              string
	Description         string
	Extract             string `validate:"required"`
	Date                string `validate:"required"`
	Location            locations.Location
	Result              string `validate:"required"`
	TerritorialChanges  string
	Strength            statistics.SideNumbers
	Casualties          statistics.SideNumbers
	Factions            SideActors
	Commanders          SideActors
	CommandersByFaction CommandersByFaction
}

Battle stores all the details regarding a specific battle as scraped from Wikipedia

type BattleItem

type BattleItem struct {
	Name string `validate:"required"`
	URL  string `validate:"required,url"`
}

BattleItem stores the name and URL of a battle after being scraped from Wikipedia's indexed list of battles

type CommandersByFaction

type CommandersByFaction map[int][]int

CommandersByFaction is a map that groups all of the WikiIDs of commanders that participated in a specific battle into their corresponding faction WikiIDs

type Reader

type Reader interface {
	Find(id int) *Battle
}

Reader is the interface through which WikiBattles may be read

type Repository

type Repository interface {
	Reader
	Writer
}

Repository is the interface through which WikiBattles may be read and written

type SideActors

type SideActors struct {
	A []int `validate:"unique"`
	B []int `validate:"unique"`
}

SideActors groups actors' WikiIDs into each side of a battle. The struct may be used for either factions or commanders

type Writer

type Writer interface {
	Save(b Battle) error
	Export(fileName string) error
}

Writer is the interface through which WikiBattles may be written

Jump to

Keyboard shortcuts

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