schema

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 Base

type Base struct {
	ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4()"`
}

Base contains common columns for all tables.

type Battle

type Battle struct {
	Base
	WikiID                  int    `gorm:"not null;uniqueIndex"`
	URL                     string `gorm:"not null;uniqueIndex"`
	Name                    string `gorm:"not null;uniqueIndex"`
	PartOf                  string
	Summary                 string  `gorm:"not null"`
	StartDate               string  `gorm:"not null;index"`
	StartDateNum            float64 `gorm:"not null;index"`
	EndDate                 string  `gorm:"not null;index"`
	EndDateNum              float64 `gorm:"not null;index"`
	Place                   string  `gorm:"not null"`
	Latitude                string
	Longitude               string
	Result                  string `gorm:"not null"`
	TerritorialChanges      string
	Strength                datatypes.JSON
	Casualties              datatypes.JSON
	BattleCommanders        []BattleCommander
	BattleFactions          []BattleFaction
	BattleCommanderFactions []BattleCommanderFaction
}

Battle is used to store data that defines a specific battle. This struct defines the SQL schema

type BattleCommander

type BattleCommander struct {
	BattleID    uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	CommanderID uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	Side        SideKind  `gorm:"type:integer;primaryKey;not null"`
	Battle      Battle
	Commander   Commander
}

BattleCommander is used to store which commanders were part of a battle, and in which side they fought. This struct defines the SQL schema

type BattleCommanderFaction

type BattleCommanderFaction struct {
	BattleID    uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	CommanderID uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	FactionID   uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	Battle      Battle
	Commander   Commander
	Faction     Faction
}

BattleCommanderFaction is used to store under which faction each commander fought in each battle. Not all commanders were always part of the same faction, and due to the way data was obtained, in some cases it is not clear to which faction a commander belonged in a specific battle. This may result in some commanders being present in battles, but not being assigned a faction. This struct defines the SQL schema

type BattleFaction

type BattleFaction struct {
	BattleID  uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	FactionID uuid.UUID `gorm:"type:uuid;primaryKey;not null"`
	Side      SideKind  `gorm:"type:integer;primaryKey;not null"`
	Battle    Battle
	Faction   Faction
}

BattleFaction is used to store which factions were part of a battle, and in which side they fought. This struct defines the SQL schema

type Commander

type Commander struct {
	Base
	WikiID  int    `gorm:"not null;uniqueIndex"`
	URL     string `gorm:"not null;uniqueIndex"`
	Name    string `gorm:"not null;index"`
	Summary string `gorm:"not null"`
}

Commander is used to store data that defines a specific commander. This struct defines the SQL schema

type Faction

type Faction struct {
	Base
	WikiID  int    `gorm:"not null;uniqueIndex"`
	URL     string `gorm:"not null;uniqueIndex"`
	Name    string `gorm:"not null;index"`
	Summary string `gorm:"not null"`
}

Faction is used to store data that defines a specific faction. This struct defines the SQL schema

type SideKind

type SideKind int64

SideKind is the type used to represent all of the sides that participated in a battle. These can be SideA, SideB, and SideAB. This separation is completely unrelated to who emerged victorious after the battle, or who "was in the right side of history"

const (
	// SideA represents one of the two possible opposing sides of a battle
	SideA SideKind = iota
	// SideB represents one of the two possible opposing sides of a battle
	SideB
	// SideAB represent a fallback for data that may not be assigned to a specific side of a battle
	SideAB
)

Jump to

Keyboard shortcuts

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