domain

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNothingToUpdate   = errors.New("nothing to update")
	ErrUnsupportedSortBy = errors.New("unsupported sort by")
)
View Source
var (
	ErrUnsupportedSortDirection = errors.New("unsupported sort direction")
)

Functions

This section is empty.

Types

type Building

type Building struct {
	MaxLevel        int8
	MinLevel        int8
	Wood            int32
	Stone           int32
	Iron            int32
	Pop             int16
	WoodFactor      float64
	StoneFactor     float64
	IronFactor      float64
	PopFactor       float64
	BuildTime       float64
	BuildTimeFactor float64
}

type BuildingInfo

type BuildingInfo struct {
	Main       Building
	Barracks   Building
	Stable     Building
	Garage     Building
	Watchtower Building
	Snob       Building
	Smith      Building
	Place      Building
	Statue     Building
	Market     Building
	Wood       Building
	Stone      Building
	Iron       Building
	Farm       Building
	Storage    Building
	Hide       Building
	Wall       Building
}

type CreateEnnoblementParams

type CreateEnnoblementParams struct {
	VillageID  int64
	NewOwnerID int64
	NewTribeID int64
	OldOwnerID int64
	OldTribeID int64
	Points     int64
	CreatedAt  time.Time
	ServerKey  string
}

type CreatePlayerParams

type CreatePlayerParams struct {
	OpponentsDefeated

	ID             int64
	Name           string
	NumVillages    int64
	Points         int64
	Rank           int64
	TribeID        int64
	ProfileURL     string
	BestRank       int64
	BestRankAt     time.Time
	MostPoints     int64
	MostPointsAt   time.Time
	MostVillages   int64
	MostVillagesAt time.Time
	LastActivityAt time.Time
	ServerKey      string
}

type CreatePlayerSnapshotParams added in v0.3.0

type CreatePlayerSnapshotParams struct {
	OpponentsDefeated

	PlayerID    int64
	NumVillages int64
	Points      int64
	Rank        int64
	TribeID     int64
	ServerKey   string
	Date        time.Time
}

type CreateServerParams

type CreateServerParams struct {
	Key         string
	URL         string
	Open        bool
	VersionCode string
}

type CreateSnapshotsCmdPayload added in v0.3.0

type CreateSnapshotsCmdPayload struct {
	Key         string
	VersionCode string
	Date        time.Time
}

type CreateTribeChangeParams added in v0.4.0

type CreateTribeChangeParams struct {
	PlayerID   int64
	NewTribeID int64
	OldTribeID int64
	ServerKey  string
}

type CreateTribeParams

type CreateTribeParams struct {
	OpponentsDefeated

	ID             int64
	Name           string
	Tag            string
	NumMembers     int64
	NumVillages    int64
	Points         int64
	AllPoints      int64
	Rank           int64
	ProfileURL     string
	BestRank       int64
	BestRankAt     time.Time
	MostPoints     int64
	MostPointsAt   time.Time
	MostVillages   int64
	MostVillagesAt time.Time
	ServerKey      string
}

type CreateTribeSnapshotParams added in v0.3.0

type CreateTribeSnapshotParams struct {
	OpponentsDefeated

	TribeID     int64
	ServerKey   string
	NumMembers  int64
	NumVillages int64
	Points      int64
	AllPoints   int64
	Rank        int64
	Dominance   float64
	Date        time.Time
}

type CreateVillageParams

type CreateVillageParams struct {
	ID         int64
	Name       string
	Points     int64
	X          int64
	Y          int64
	Continent  string
	Bonus      int64
	PlayerID   int64
	ProfileURL string
	ServerKey  string
}

type Ennoblement

type Ennoblement struct {
	ID         int64
	VillageID  int64
	NewOwnerID int64
	NewTribeID int64
	OldOwnerID int64
	OldTribeID int64
	Points     int64
	CreatedAt  time.Time
	ServerKey  string
}

type EnnoblementSort

type EnnoblementSort struct {
	By        EnnoblementSortBy
	Direction SortDirection
}

func NewEnnoblementSort added in v0.7.5

func NewEnnoblementSort(by, dir string) (EnnoblementSort, error)

type EnnoblementSortBy

type EnnoblementSortBy uint8
const (
	EnnoblementSortByCreatedAt EnnoblementSortBy = iota
)

type EnnoblementWithRelations added in v0.2.0

type EnnoblementWithRelations struct {
	Ennoblement

	Village  VillageMeta
	NewOwner NullPlayerMeta
	NewTribe NullTribeMeta
	OldOwner NullPlayerMeta
	OldTribe NullTribeMeta
}

type Error added in v0.6.6

type Error interface {
	error
	// UserError is a message that is returned to a user in, for example, an http response.
	UserError() string
	Code() ErrorCode
}

type ErrorCode

type ErrorCode uint8
const (
	ErrorCodeUnknown ErrorCode = iota
	ErrorCodeEntityNotFound
	ErrorCodeValidationError
)

func (ErrorCode) String

func (e ErrorCode) String() string

type ListEnnoblementsParams

type ListEnnoblementsParams struct {
	ServerKeys   []string
	CreatedAtGTE NullTime
	CreatedAtLTE NullTime
	// PlayerID filters out ennoblements whose NewOwnerID OR OldOwnerID isn't equal to the provided value.
	PlayerID int64
	// TribeID filters out ennoblements whose NewTribeID OR OldTribeID isn't equal to the provided value.
	TribeID    int64
	VillageID  int64
	Pagination Pagination
	Sort       []EnnoblementSort
}

type ListPlayerSnapshotsParams added in v0.6.0

type ListPlayerSnapshotsParams struct {
	ServerKeys []string
	PlayerIDs  []int64
	Pagination Pagination
	Sort       []PlayerSnapshotSort
}

type ListPlayersParams

type ListPlayersParams struct {
	IDs           []int64
	IDGT          NullInt64
	ServerKeys    []string
	ServerKeysNIN []string
	VersionCodes  []string
	Deleted       NullBool
	TribeID       int64
	Pagination    Pagination
	Sort          []PlayerSort
}

type ListServersParams

type ListServersParams struct {
	Keys                       []string
	Special                    NullBool
	Open                       NullBool
	PlayerSnapshotsCreatedAtLT time.Time
	TribeSnapshotsCreatedAtLT  time.Time
	VersionCodes               []string
	Pagination                 Pagination
}

type ListTribeChangesParams added in v0.7.5

type ListTribeChangesParams struct {
	ServerKeys []string
	PlayerIDs  []int64
	// TribeIDs filters out tribe changes whose NewTribeID OR OldTribeID isn't in the provided slice.
	TribeIDs   []int64
	Pagination Pagination
	Sort       []TribeChangeSort
}

type ListTribeSnapshotsParams added in v0.6.0

type ListTribeSnapshotsParams struct {
	ServerKeys []string
	TribeIDs   []int64
	Pagination Pagination
	Sort       []TribeSnapshotSort
}

type ListTribesParams

type ListTribesParams struct {
	IDs        []int64
	IDGT       NullInt64
	Tags       []string
	ServerKeys []string
	Deleted    NullBool
	Pagination Pagination
	Sort       []TribeSort
}

type ListVillagesParams

type ListVillagesParams struct {
	IDs        []int64
	ServerKeys []string
	Pagination Pagination
}

type MaxError

type MaxError struct {
	Max int
}

func (MaxError) Code

func (e MaxError) Code() ErrorCode

func (MaxError) Error

func (e MaxError) Error() string

func (MaxError) UserError

func (e MaxError) UserError() string

type MaxLengthError

type MaxLengthError struct {
	Max int
}

func (MaxLengthError) Code

func (e MaxLengthError) Code() ErrorCode

func (MaxLengthError) Error

func (e MaxLengthError) Error() string

func (MaxLengthError) UserError

func (e MaxLengthError) UserError() string

type MinError

type MinError struct {
	Min int
}

func (MinError) Code

func (e MinError) Code() ErrorCode

func (MinError) Error

func (e MinError) Error() string

func (MinError) UserError

func (e MinError) UserError() string

type NullBool

type NullBool struct {
	Bool  bool
	Valid bool // Valid is true if Bool is not NULL
}

type NullBuildingInfo

type NullBuildingInfo struct {
	Info  BuildingInfo
	Valid bool // Valid is true if Info is not NULL
}

type NullInt32

type NullInt32 struct {
	Int32 int32
	Valid bool // Valid is true if Int32 is not NULL
}

type NullInt64

type NullInt64 struct {
	Int64 int64
	Valid bool // Valid is true if Int64 is not NULL
}

type NullPlayerMeta added in v0.2.0

type NullPlayerMeta struct {
	Valid  bool
	Player PlayerMeta
}

type NullPlayerMetaWithRelations added in v0.2.0

type NullPlayerMetaWithRelations struct {
	Valid  bool
	Player PlayerMetaWithRelations
}

type NullServerConfig

type NullServerConfig struct {
	Config ServerConfig
	Valid  bool // Valid is true if Config is not NULL
}

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

type NullTribeMeta added in v0.2.0

type NullTribeMeta struct {
	Valid bool
	Tribe TribeMeta
}

type NullUnitInfo

type NullUnitInfo struct {
	Info  UnitInfo
	Valid bool // Valid is true if Info is not NULL
}

type OpponentsDefeated

type OpponentsDefeated struct {
	RankAtt    int64
	ScoreAtt   int64
	RankDef    int64
	ScoreDef   int64
	RankSup    int64
	ScoreSup   int64
	RankTotal  int64
	ScoreTotal int64
}

type Pagination

type Pagination struct {
	Offset int32
	Limit  int32
}

type Player

type Player struct {
	OpponentsDefeated

	ID             int64
	Name           string
	NumVillages    int64
	Points         int64
	Rank           int64
	TribeID        int64
	ProfileURL     string
	BestRank       int64
	BestRankAt     time.Time
	MostPoints     int64
	MostPointsAt   time.Time
	MostVillages   int64
	MostVillagesAt time.Time
	LastActivityAt time.Time
	ServerKey      string
	CreatedAt      time.Time
	DeletedAt      time.Time
}

type PlayerMeta added in v0.2.0

type PlayerMeta struct {
	ID         int64
	Name       string
	ProfileURL string
}

type PlayerMetaWithRelations added in v0.2.0

type PlayerMetaWithRelations struct {
	PlayerMeta

	Tribe NullTribeMeta
}

type PlayerNotFoundError

type PlayerNotFoundError struct {
	ID int64
}

func (PlayerNotFoundError) Code

func (e PlayerNotFoundError) Code() ErrorCode

func (PlayerNotFoundError) Error

func (e PlayerNotFoundError) Error() string

func (PlayerNotFoundError) UserError

func (e PlayerNotFoundError) UserError() string

type PlayerSnapshot added in v0.3.0

type PlayerSnapshot struct {
	OpponentsDefeated

	ID          int64
	PlayerID    int64
	ServerKey   string
	NumVillages int64
	Points      int64
	Rank        int64
	TribeID     int64
	Date        time.Time
	CreatedAt   time.Time
}

type PlayerSnapshotSort added in v0.7.0

type PlayerSnapshotSort struct {
	By        PlayerSnapshotSortBy
	Direction SortDirection
}

func NewPlayerSnapshotSort added in v0.7.5

func NewPlayerSnapshotSort(by, dir string) (PlayerSnapshotSort, error)

type PlayerSnapshotSortBy added in v0.7.0

type PlayerSnapshotSortBy uint8
const (
	PlayerSnapshotSortByID PlayerSnapshotSortBy = iota
	PlayerSnapshotSortByDate
)

type PlayerSnapshotWithRelations added in v0.7.0

type PlayerSnapshotWithRelations struct {
	PlayerSnapshot

	Tribe NullTribeMeta
}

type PlayerSort

type PlayerSort struct {
	By        PlayerSortBy
	Direction SortDirection
}

func NewPlayerSort added in v0.7.5

func NewPlayerSort(by, dir string) (PlayerSort, error)

type PlayerSortBy

type PlayerSortBy uint8
const (
	PlayerSortByID PlayerSortBy = iota
	PlayerSortByScoreAtt
	PlayerSortByScoreDef
	PlayerSortByScoreSup
	PlayerSortByScoreTotal
	PlayerSortByPoints
	PlayerSortByDeletedAt
)

type PlayerWithRelations added in v0.2.0

type PlayerWithRelations struct {
	Player

	Tribe  NullTribeMeta
	Server ServerMeta
}

type RefreshEnnoblementsCmdPayload

type RefreshEnnoblementsCmdPayload struct {
	Key         string
	URL         string
	VersionCode string
}

type RefreshServersCmdPayload

type RefreshServersCmdPayload struct {
	Host        string
	VersionCode string
}

type RefreshVillagesResult

type RefreshVillagesResult struct {
	NumVillages          int64
	NumPlayerVillages    int64
	NumBarbarianVillages int64
	NumBonusVillages     int64
}

type Server

type Server struct {
	Key                      string
	URL                      string
	Open                     bool
	Special                  bool
	NumPlayers               int64
	NumTribes                int64
	NumVillages              int64
	NumPlayerVillages        int64
	NumBarbarianVillages     int64
	NumBonusVillages         int64
	Config                   ServerConfig
	BuildingInfo             BuildingInfo
	UnitInfo                 UnitInfo
	CreatedAt                time.Time
	PlayerDataUpdatedAt      time.Time
	PlayerSnapshotsCreatedAt time.Time
	TribeDataUpdatedAt       time.Time
	TribeSnapshotsCreatedAt  time.Time
	VillageDataUpdatedAt     time.Time
	EnnoblementDataUpdatedAt time.Time
	VersionCode              string
}

type ServerConfigAlly

type ServerConfigAlly struct {
	NoHarm                int8
	NoOtherSupport        int8
	NoOtherSupportType    int8
	AllytimeSupport       int32
	NoLeave               int8
	NoJoin                int8
	Limit                 int16
	FixedAllies           int8
	PointsMemberCount     int32
	WarsMemberRequirement int16
	WarsPointsRequirement int32
	WarsAutoacceptDays    int16
	Levels                int8
	XpRequirements        string
}

type ServerConfigBuild

type ServerConfigBuild struct {
	Destroy int8
}

type ServerConfigBuildings

type ServerConfigBuildings struct {
	CustomMain       int8
	CustomFarm       int8
	CustomStorage    int8
	CustomPlace      int8
	CustomBarracks   int8
	CustomChurch     int8
	CustomSmith      int8
	CustomWood       int8
	CustomStone      int8
	CustomIron       int8
	CustomMarket     int8
	CustomStable     int8
	CustomWall       int8
	CustomGarage     int8
	CustomHide       int8
	CustomSnob       int8
	CustomStatue     int8
	CustomWatchtower int8
}

type ServerConfigCommands

type ServerConfigCommands struct {
	MillisArrival     int16
	CommandCancelTime int16
}

type ServerConfigCoord

type ServerConfigCoord struct {
	MapSize         int16
	Func            int8
	EmptyVillages   int16
	BonusVillages   int16
	BonusNew        int16
	Inner           int16
	SelectStart     int8
	VillageMoveWait int32
	NobleRestart    int8
	StartVillages   int8
}

type ServerConfigGame

type ServerConfigGame struct {
	BuildtimeFormula   int8
	Knight             int8
	KnightNewItems     int8
	Archer             int8
	Tech               int8
	FarmLimit          int32
	Church             int8
	Watchtower         int8
	Stronghold         int8
	FakeLimit          float64
	BarbarianRise      float64
	BarbarianShrink    int8
	BarbarianMaxPoints int32
	Scavenging         int8
	Hauls              int8
	HaulsBase          int32
	HaulsMax           int32
	BaseProduction     int32
	Event              int16
	SuppressEvents     int8
}

type ServerConfigMisc

type ServerConfigMisc struct {
	KillRanking     int8
	Tutorial        int8
	TradeCancelTime int16
}

type ServerConfigNewbie

type ServerConfigNewbie struct {
	Days                 int16
	RatioDays            int16
	Ratio                int16
	RemoveNewbieVillages int8
}

type ServerConfigNight

type ServerConfigNight struct {
	Active    int8
	StartHour int8
	EndHour   int8
	DefFactor float64
	Duration  int8
}

type ServerConfigSitter

type ServerConfigSitter struct {
	Allow int8
}

type ServerConfigSleep

type ServerConfigSleep struct {
	Active   int8
	Delay    int32
	Min      int16
	Max      int16
	MinAwake int16
	MaxAwake int16
	WarnTime int16
}

type ServerConfigSnob

type ServerConfigSnob struct {
	Gold          int8
	CheapRebuild  int8
	Rise          int8
	MaxDist       int16
	Factor        float64
	CoinWood      int32
	CoinStone     int32
	CoinIron      int32
	NoBarbConquer int8
}

type ServerConfigWin

type ServerConfigWin struct {
	Check int16
}

type ServerMeta added in v0.8.3

type ServerMeta struct {
	Key  string
	URL  string
	Open bool
}

type ServerNotFoundError

type ServerNotFoundError struct {
	Key string
}

func (ServerNotFoundError) Code

func (e ServerNotFoundError) Code() ErrorCode

func (ServerNotFoundError) Error

func (e ServerNotFoundError) Error() string

func (ServerNotFoundError) UserError

func (e ServerNotFoundError) UserError() string

type SliceValidationError added in v0.11.1

type SliceValidationError struct {
	Field string
	Index int
	Err   error
}

func (SliceValidationError) Code added in v0.11.1

func (SliceValidationError) Error added in v0.11.1

func (e SliceValidationError) Error() string

func (SliceValidationError) Unwrap added in v0.11.1

func (e SliceValidationError) Unwrap() error

func (SliceValidationError) UserError added in v0.11.1

func (e SliceValidationError) UserError() string

type SortDirection

type SortDirection uint8
const (
	SortDirectionASC SortDirection = iota
	SortDirectionDESC
)

type Tribe

type Tribe struct {
	OpponentsDefeated

	ID             int64
	Name           string
	Tag            string
	NumMembers     int64
	NumVillages    int64
	Points         int64 // points of top x players
	AllPoints      int64
	Rank           int64
	Dominance      float64
	ProfileURL     string
	BestRank       int64
	BestRankAt     time.Time
	MostPoints     int64
	MostPointsAt   time.Time
	MostVillages   int64
	MostVillagesAt time.Time
	ServerKey      string
	CreatedAt      time.Time
	DeletedAt      time.Time
}

type TribeChange added in v0.4.0

type TribeChange struct {
	ID         int64
	PlayerID   int64
	NewTribeID int64
	OldTribeID int64
	ServerKey  string
	CreatedAt  time.Time
}

type TribeChangeSort added in v0.7.5

type TribeChangeSort struct {
	By        TribeChangeSortBy
	Direction SortDirection
}

func NewTribeChangeSort added in v0.7.5

func NewTribeChangeSort(by, dir string) (TribeChangeSort, error)

type TribeChangeSortBy added in v0.7.5

type TribeChangeSortBy uint8
const (
	TribeChangeSortByID TribeChangeSortBy = iota
	TribeChangeSortByCreatedAt
)

type TribeChangeWithRelations added in v0.7.5

type TribeChangeWithRelations struct {
	TribeChange

	Player   PlayerMeta
	NewTribe NullTribeMeta
	OldTribe NullTribeMeta
}

type TribeMeta added in v0.2.0

type TribeMeta struct {
	ID         int64
	Name       string
	Tag        string
	ProfileURL string
}

type TribeNotFoundError

type TribeNotFoundError struct {
	ID int64
}

func (TribeNotFoundError) Code

func (e TribeNotFoundError) Code() ErrorCode

func (TribeNotFoundError) Error

func (e TribeNotFoundError) Error() string

func (TribeNotFoundError) UserError

func (e TribeNotFoundError) UserError() string

type TribeSnapshot added in v0.3.0

type TribeSnapshot struct {
	OpponentsDefeated

	ID          int64
	TribeID     int64
	ServerKey   string
	NumMembers  int64
	NumVillages int64
	Points      int64
	AllPoints   int64
	Rank        int64
	Dominance   float64
	Date        time.Time
	CreatedAt   time.Time
}

type TribeSnapshotSort added in v0.10.0

type TribeSnapshotSort struct {
	By        TribeSnapshotSortBy
	Direction SortDirection
}

func NewTribeSnapshotSort added in v0.10.0

func NewTribeSnapshotSort(by, dir string) (TribeSnapshotSort, error)

type TribeSnapshotSortBy added in v0.10.0

type TribeSnapshotSortBy uint8
const (
	TribeSnapshotSortByID TribeSnapshotSortBy = iota
	TribeSnapshotSortByDate
)

type TribeSort

type TribeSort struct {
	By        TribeSortBy
	Direction SortDirection
}

func NewTribeSort added in v0.7.5

func NewTribeSort(by, dir string) (TribeSort, error)

type TribeSortBy

type TribeSortBy uint8
const (
	TribeSortByID TribeSortBy = iota
	TribeSortByScoreAtt
	TribeSortByScoreDef
	TribeSortByScoreTotal
	TribeSortByPoints
	TribeSortByDominance
	TribeSortByDeletedAt
)

type Unit

type Unit struct {
	BuildTime      float64
	Pop            int16
	Speed          float64
	Attack         int16
	Defense        int16
	DefenseCavalry int16
	DefenseArcher  int16
	Carry          int16
}

type UnitInfo

type UnitInfo struct {
	Spear    Unit
	Sword    Unit
	Axe      Unit
	Archer   Unit
	Spy      Unit
	Light    Unit
	Marcher  Unit
	Heavy    Unit
	Ram      Unit
	Catapult Unit
	Knight   Unit
	Snob     Unit
	Militia  Unit
}

type UpdateServerParams

type UpdateServerParams struct {
	Config                   NullServerConfig
	BuildingInfo             NullBuildingInfo
	UnitInfo                 NullUnitInfo
	NumPlayers               NullInt64
	PlayerDataUpdatedAt      time.Time
	PlayerSnapshotsCreatedAt time.Time
	NumTribes                NullInt64
	TribeDataUpdatedAt       time.Time
	TribeSnapshotsCreatedAt  time.Time
	NumVillages              NullInt64
	NumPlayerVillages        NullInt64
	NumBarbarianVillages     NullInt64
	NumBonusVillages         NullInt64
	VillageDataUpdatedAt     time.Time
	EnnoblementDataUpdatedAt time.Time
}

func (UpdateServerParams) IsZero

func (u UpdateServerParams) IsZero() bool

type ValidationError

type ValidationError struct {
	Field string
	Err   error
}

func (ValidationError) Code

func (e ValidationError) Code() ErrorCode

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) Unwrap

func (e ValidationError) Unwrap() error

func (ValidationError) UserError

func (e ValidationError) UserError() string

type Version

type Version struct {
	Code     string
	Name     string
	Host     string
	Timezone string
}

type VersionNotFoundError

type VersionNotFoundError struct {
	VerCode string
}

func (VersionNotFoundError) Code

func (VersionNotFoundError) Error

func (e VersionNotFoundError) Error() string

func (VersionNotFoundError) UserError

func (e VersionNotFoundError) UserError() string

type Village

type Village struct {
	ID         int64
	Name       string
	Points     int64
	X          int64
	Y          int64
	Continent  string
	Bonus      int64
	PlayerID   int64
	ProfileURL string
	ServerKey  string
	CreatedAt  time.Time
}

func (Village) FullName

func (v Village) FullName() string

type VillageMeta added in v0.2.0

type VillageMeta struct {
	ID         int64
	Name       string
	X          int64
	Y          int64
	Continent  string
	ProfileURL string
}

func (VillageMeta) FullName added in v0.2.0

func (v VillageMeta) FullName() string

type VillageMetaWithRelations added in v0.8.0

type VillageMetaWithRelations struct {
	VillageMeta

	Player NullPlayerMetaWithRelations
}

type VillageNotFoundError

type VillageNotFoundError struct {
	ID int64
}

func (VillageNotFoundError) Code

func (VillageNotFoundError) Error

func (e VillageNotFoundError) Error() string

func (VillageNotFoundError) UserError

func (e VillageNotFoundError) UserError() string

type VillageWithRelations added in v0.2.0

type VillageWithRelations struct {
	Village

	Player NullPlayerMetaWithRelations
}

Jump to

Keyboard shortcuts

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