service

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ennoblement

type Ennoblement struct {
	// contains filtered or unexported fields
}

func NewEnnoblement

func NewEnnoblement(repo EnnoblementRepository, client EnnoblementGetter) *Ennoblement

func (*Ennoblement) List

func (*Ennoblement) Refresh

func (e *Ennoblement) Refresh(ctx context.Context, key, url string) error

type EnnoblementGetter

type EnnoblementGetter interface {
	GetEnnoblements(ctx context.Context, baseURL string, since time.Time) ([]domain.BaseEnnoblement, error)
}

type EnnoblementPublisher

type EnnoblementPublisher interface {
	CmdRefresh(_ context.Context, payloads ...domain.RefreshEnnoblementsCmdPayload) error
}

type EnnoblementRepository

type EnnoblementRepository interface {
	Create(ctx context.Context, params ...domain.CreateEnnoblementParams) error
	List(ctx context.Context, params domain.ListEnnoblementsParams) ([]domain.Ennoblement, int64, error)
}

type OpenServerConfigInfoGetter

type OpenServerConfigInfoGetter interface {
	GetOpenServers(ctx context.Context, baseURL string) ([]domain.OpenServer, error)
	GetServerConfig(ctx context.Context, baseURL string) (domain.ServerConfig, error)
	GetBuildingInfo(ctx context.Context, baseURL string) (domain.BuildingInfo, error)
	GetUnitInfo(ctx context.Context, baseURL string) (domain.UnitInfo, error)
}

type Player

type Player struct {
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(repo PlayerRepository, client PlayerGetter) *Player

func (*Player) GetByServerKeyAndID

func (p *Player) GetByServerKeyAndID(ctx context.Context, serverKey string, id int64, includeTribe bool) (domain.Player, error)

func (*Player) List

func (p *Player) List(ctx context.Context, params domain.ListPlayersParams) ([]domain.Player, int64, error)

func (*Player) Refresh

func (p *Player) Refresh(ctx context.Context, key, url string) (int64, error)

type PlayerGetter

type PlayerGetter interface {
	GetPlayers(ctx context.Context, baseURL string) ([]domain.BasePlayer, error)
}

type PlayerRepository

type PlayerRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreatePlayerParams) error
	DeleteByID(ctx context.Context, ids ...int64) error
	List(ctx context.Context, params domain.ListPlayersParams) ([]domain.Player, int64, error)
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(repo ServerRepository, client OpenServerConfigInfoGetter) *Server

func (*Server) GetNormalByVersionCodeAndKey

func (s *Server) GetNormalByVersionCodeAndKey(ctx context.Context, versionCode, key string) (domain.Server, error)

func (*Server) List

func (s *Server) List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, int64, error)

func (*Server) Refresh

func (s *Server) Refresh(ctx context.Context, host, versionCode string) ([]domain.Server, error)

func (*Server) UpdateInfoAndConfig

func (s *Server) UpdateInfoAndConfig(ctx context.Context, key, url string) error

func (*Server) UpdateNumPlayers

func (s *Server) UpdateNumPlayers(ctx context.Context, key string, numPlayers int64) error

func (*Server) UpdateNumTribes

func (s *Server) UpdateNumTribes(ctx context.Context, key string, numTribes int64) error

func (*Server) UpdateNumVillages

func (s *Server) UpdateNumVillages(ctx context.Context, key string, numVillages int64) error

type ServerLister

type ServerLister interface {
	List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, int64, error)
}

type ServerPublisher

type ServerPublisher interface {
	CmdRefresh(_ context.Context, payloads ...domain.RefreshServersCmdPayload) error
}

type ServerRepository

type ServerRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateServerParams) ([]domain.Server, error)
	List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, int64, error)
	UpdateByKey(ctx context.Context, key string, params domain.UpdateServerParams) (domain.Server, error)
}

type Tribe

type Tribe struct {
	// contains filtered or unexported fields
}

func NewTribe

func NewTribe(repo TribeRepository, client TribeGetter) *Tribe

func (*Tribe) GetByServerKeyAndID

func (t *Tribe) GetByServerKeyAndID(ctx context.Context, serverKey string, id int64) (domain.Tribe, error)

func (*Tribe) GetByServerKeyAndTag

func (t *Tribe) GetByServerKeyAndTag(ctx context.Context, serverKey string, tag string) (domain.Tribe, error)

func (*Tribe) List

func (t *Tribe) List(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, int64, error)

func (*Tribe) Refresh

func (t *Tribe) Refresh(ctx context.Context, key, url string) (int64, error)

func (*Tribe) UpdateDominance

func (t *Tribe) UpdateDominance(ctx context.Context, serverKey string, numPlayerVillages int64) error

type TribeGetter

type TribeGetter interface {
	GetTribes(ctx context.Context, baseURL string) ([]domain.BaseTribe, error)
}

type TribeRepository

type TribeRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateTribeParams) error
	UpdateDominance(ctx context.Context, serverKey string, numVillages int64) error
	DeleteByID(ctx context.Context, ids ...int64) error
	List(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, int64, error)
}

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater(
	versionSvc VersionLister,
	serverSvc ServerLister,
	serverPublisher ServerPublisher,
	ennoblementPublisher EnnoblementPublisher,
) *Updater

func (*Updater) UpdateData

func (u *Updater) UpdateData(ctx context.Context) error

func (*Updater) UpdateEnnoblements

func (u *Updater) UpdateEnnoblements(ctx context.Context) error

type Version

type Version struct {
	// contains filtered or unexported fields
}

func NewVersion

func NewVersion(repo VersionRepository) *Version

func (*Version) GetByCode

func (v *Version) GetByCode(ctx context.Context, code string) (domain.Version, error)

func (*Version) List

type VersionLister

type VersionLister interface {
	List(ctx context.Context, params domain.ListVersionsParams) ([]domain.Version, int64, error)
}

type VersionRepository

type VersionRepository interface {
	List(ctx context.Context, params domain.ListVersionsParams) ([]domain.Version, int64, error)
	GetByCode(ctx context.Context, code string) (domain.Version, error)
}

type Village

type Village struct {
	// contains filtered or unexported fields
}

func NewVillage

func NewVillage(repo VillageRepository, client VillageGetter) *Village

func (*Village) GetByServerKeyAndID

func (v *Village) GetByServerKeyAndID(
	ctx context.Context,
	serverKey string,
	id int64,
	includePlayer, includePlayerTribe bool,
) (domain.Village, error)

func (*Village) List

func (*Village) Refresh

func (v *Village) Refresh(ctx context.Context, key, url string) (domain.RefreshVillagesResult, error)

type VillageGetter

type VillageGetter interface {
	GetVillages(ctx context.Context, baseURL string) ([]domain.BaseVillage, error)
}

type VillageRepository

type VillageRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateVillageParams) error
	List(ctx context.Context, params domain.ListVillagesParams) ([]domain.Village, int64, error)
}

Jump to

Keyboard shortcuts

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