Documentation ¶
Index ¶
- type DataCleanupPublisher
- type DataCleanupService
- type DataSyncService
- type EnnoblementPublisher
- type EnnoblementRepository
- type EnnoblementService
- func (svc *EnnoblementService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
- func (svc *EnnoblementService) List(ctx context.Context, params domain.ListEnnoblementsParams) (domain.ListEnnoblementsResult, error)
- func (svc *EnnoblementService) ListWithRelations(ctx context.Context, params domain.ListEnnoblementsParams) (domain.ListEnnoblementsWithRelationsResult, error)
- func (svc *EnnoblementService) Sync(ctx context.Context, ...) error
- type PlayerPublisher
- type PlayerRepository
- type PlayerService
- func (svc *PlayerService) GetWithRelations(ctx context.Context, id int, serverKey string) (domain.PlayerWithRelations, error)
- func (svc *PlayerService) List(ctx context.Context, params domain.ListPlayersParams) (domain.ListPlayersResult, error)
- func (svc *PlayerService) ListWithRelations(ctx context.Context, params domain.ListPlayersParams) (domain.ListPlayersWithRelationsResult, error)
- func (svc *PlayerService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
- type PlayerSnapshotRepository
- type PlayerSnapshotService
- func (svc *PlayerSnapshotService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
- func (svc *PlayerSnapshotService) Create(ctx context.Context, ...) error
- func (svc *PlayerSnapshotService) ListWithRelations(ctx context.Context, params domain.ListPlayerSnapshotsParams) (domain.ListPlayerSnapshotsWithRelationsResult, error)
- type ServerPublisher
- type ServerRepository
- type ServerService
- func (svc *ServerService) GetNormalByVersionCodeAndServerKey(ctx context.Context, versionCode, key string) (domain.Server, error)
- func (svc *ServerService) List(ctx context.Context, params domain.ListServersParams) (domain.ListServersResult, error)
- func (svc *ServerService) ListAll(ctx context.Context, params domain.ListServersParams) (domain.Servers, error)
- func (svc *ServerService) ListAllOpen(ctx context.Context, versionCode string) (domain.Servers, error)
- func (svc *ServerService) Sync(ctx context.Context, payload domain.SyncServersCmdPayload) error
- func (svc *ServerService) SyncConfigAndInfo(ctx context.Context, payload domain.ServerSyncedEventPayload) error
- func (svc *ServerService) UpdateEnnoblementDataSyncedAt(ctx context.Context, payload domain.EnnoblementsSyncedEventPayload) error
- func (svc *ServerService) UpdateNumPlayers(ctx context.Context, payload domain.PlayersSyncedEventPayload) error
- func (svc *ServerService) UpdateNumTribes(ctx context.Context, payload domain.TribesSyncedEventPayload) error
- func (svc *ServerService) UpdateNumVillages(ctx context.Context, payload domain.VillagesSyncedEventPayload) error
- func (svc *ServerService) UpdatePlayerSnapshotsCreatedAt(ctx context.Context, payload domain.SnapshotsCreatedEventPayload) error
- func (svc *ServerService) UpdateSnapshotCreatedAt(ctx context.Context, key string) error
- func (svc *ServerService) UpdateTribeSnapshotsCreatedAt(ctx context.Context, payload domain.SnapshotsCreatedEventPayload) error
- type ServerSnapshotRepository
- type ServerSnapshotService
- type SnapshotPublisher
- type SnapshotService
- type TWService
- type TribeChangeRepository
- type TribeChangeService
- func (svc *TribeChangeService) Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error
- func (svc *TribeChangeService) List(ctx context.Context, params domain.ListTribeChangesParams) (domain.ListTribeChangesResult, error)
- func (svc *TribeChangeService) ListWithRelations(ctx context.Context, params domain.ListTribeChangesParams) (domain.ListTribeChangesWithRelationsResult, error)
- type TribePublisher
- type TribeRepository
- type TribeService
- func (svc *TribeService) Get(ctx context.Context, id int, serverKey string) (domain.Tribe, error)
- func (svc *TribeService) List(ctx context.Context, params domain.ListTribesParams) (domain.ListTribesResult, error)
- func (svc *TribeService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
- func (svc *TribeService) UpdateDominance(ctx context.Context, payload domain.VillagesSyncedEventPayload) error
- type TribeSnapshotRepository
- type TribeSnapshotService
- func (svc *TribeSnapshotService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
- func (svc *TribeSnapshotService) Create(ctx context.Context, ...) error
- func (svc *TribeSnapshotService) ListWithRelations(ctx context.Context, params domain.ListTribeSnapshotsParams) (domain.ListTribeSnapshotsWithRelationsResult, error)
- type VersionRepository
- type VersionService
- type VillagePublisher
- type VillageRepository
- type VillageService
- func (svc *VillageService) GetWithRelations(ctx context.Context, id int, serverKey string) (domain.VillageWithRelations, error)
- func (svc *VillageService) List(ctx context.Context, params domain.ListVillagesParams) (domain.ListVillagesResult, error)
- func (svc *VillageService) ListWithRelations(ctx context.Context, params domain.ListVillagesParams) (domain.ListVillagesWithRelationsResult, error)
- func (svc *VillageService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataCleanupPublisher ¶
type DataCleanupPublisher interface {
CmdCleanUp(ctx context.Context, payloads ...domain.CleanUpDataCmdPayload) error
}
type DataCleanupService ¶
type DataCleanupService struct {
// contains filtered or unexported fields
}
func NewDataCleanupService ¶
func NewDataCleanupService(serverSvc *ServerService, pub DataCleanupPublisher) *DataCleanupService
type DataSyncService ¶
type DataSyncService struct {
// contains filtered or unexported fields
}
func NewDataSyncService ¶
func NewDataSyncService( versionSvc *VersionService, serverSvc *ServerService, serverPub ServerPublisher, ennoblementPub EnnoblementPublisher, ) *DataSyncService
func (*DataSyncService) SyncEnnoblements ¶
func (svc *DataSyncService) SyncEnnoblements(ctx context.Context) error
type EnnoblementPublisher ¶
type EnnoblementPublisher interface { CmdSync(ctx context.Context, payloads ...domain.SyncEnnoblementsCmdPayload) error EventSynced(ctx context.Context, payloads ...domain.EnnoblementsSyncedEventPayload) error }
type EnnoblementRepository ¶
type EnnoblementRepository interface { Create(ctx context.Context, params ...domain.CreateEnnoblementParams) error List(ctx context.Context, params domain.ListEnnoblementsParams) (domain.ListEnnoblementsResult, error) ListWithRelations( ctx context.Context, params domain.ListEnnoblementsParams, ) (domain.ListEnnoblementsWithRelationsResult, error) Delete(ctx context.Context, serverKey string, createdAtLTE time.Time) error }
type EnnoblementService ¶
type EnnoblementService struct {
// contains filtered or unexported fields
}
func NewEnnoblementService ¶
func NewEnnoblementService(repo EnnoblementRepository, twSvc TWService, pub EnnoblementPublisher) *EnnoblementService
func (*EnnoblementService) CleanUp ¶
func (svc *EnnoblementService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
func (*EnnoblementService) List ¶
func (svc *EnnoblementService) List( ctx context.Context, params domain.ListEnnoblementsParams, ) (domain.ListEnnoblementsResult, error)
func (*EnnoblementService) ListWithRelations ¶
func (svc *EnnoblementService) ListWithRelations( ctx context.Context, params domain.ListEnnoblementsParams, ) (domain.ListEnnoblementsWithRelationsResult, error)
func (*EnnoblementService) Sync ¶
func (svc *EnnoblementService) Sync( ctx context.Context, syncEnnoblementsCmdPayload domain.SyncEnnoblementsCmdPayload, ) error
type PlayerPublisher ¶
type PlayerPublisher interface {
EventSynced(ctx context.Context, payloads ...domain.PlayersSyncedEventPayload) error
}
type PlayerRepository ¶
type PlayerRepository interface { CreateOrUpdate(ctx context.Context, params ...domain.CreatePlayerParams) error List(ctx context.Context, params domain.ListPlayersParams) (domain.ListPlayersResult, error) ListWithRelations(ctx context.Context, params domain.ListPlayersParams) (domain.ListPlayersWithRelationsResult, error) Count(ctx context.Context, params domain.CountPlayersParams) (int, error) // Delete marks players with the given serverKey and ids as deleted (sets deleted at to now). // In addition, Delete sets TribeID to null. // // https://en.wiktionary.org/wiki/soft_deletion Delete(ctx context.Context, serverKey string, ids ...int) error }
type PlayerService ¶
type PlayerService struct {
// contains filtered or unexported fields
}
func NewPlayerService ¶
func NewPlayerService( repo PlayerRepository, tribeChangeSvc *TribeChangeService, twSvc TWService, pub PlayerPublisher, ) *PlayerService
func (*PlayerService) GetWithRelations ¶
func (svc *PlayerService) GetWithRelations( ctx context.Context, id int, serverKey string, ) (domain.PlayerWithRelations, error)
func (*PlayerService) List ¶
func (svc *PlayerService) List(ctx context.Context, params domain.ListPlayersParams) (domain.ListPlayersResult, error)
func (*PlayerService) ListWithRelations ¶
func (svc *PlayerService) ListWithRelations( ctx context.Context, params domain.ListPlayersParams, ) (domain.ListPlayersWithRelationsResult, error)
func (*PlayerService) Sync ¶
func (svc *PlayerService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
type PlayerSnapshotRepository ¶
type PlayerSnapshotRepository interface { // Create persists player snapshots in a store (e.g. Postgres). // Duplicates are ignored. Create(ctx context.Context, params ...domain.CreatePlayerSnapshotParams) error ListWithRelations( ctx context.Context, params domain.ListPlayerSnapshotsParams, ) (domain.ListPlayerSnapshotsWithRelationsResult, error) Delete(ctx context.Context, serverKey string, dateLTE time.Time) error }
type PlayerSnapshotService ¶
type PlayerSnapshotService struct {
// contains filtered or unexported fields
}
func NewPlayerSnapshotService ¶
func NewPlayerSnapshotService( repo PlayerSnapshotRepository, playerSvc *PlayerService, pub SnapshotPublisher, ) *PlayerSnapshotService
func (*PlayerSnapshotService) CleanUp ¶
func (svc *PlayerSnapshotService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
func (*PlayerSnapshotService) Create ¶
func (svc *PlayerSnapshotService) Create( ctx context.Context, createSnapshotsCmdPayload domain.CreateSnapshotsCmdPayload, ) error
func (*PlayerSnapshotService) ListWithRelations ¶
func (svc *PlayerSnapshotService) ListWithRelations( ctx context.Context, params domain.ListPlayerSnapshotsParams, ) (domain.ListPlayerSnapshotsWithRelationsResult, error)
type ServerPublisher ¶
type ServerPublisher interface { CmdSync(ctx context.Context, payloads ...domain.SyncServersCmdPayload) error EventSynced(ctx context.Context, payloads ...domain.ServerSyncedEventPayload) error }
type ServerRepository ¶
type ServerRepository interface { CreateOrUpdate(ctx context.Context, params ...domain.CreateServerParams) error List(ctx context.Context, params domain.ListServersParams) (domain.ListServersResult, error) Update(ctx context.Context, key string, params domain.UpdateServerParams) error }
type ServerService ¶
type ServerService struct {
// contains filtered or unexported fields
}
func NewServerService ¶
func NewServerService(repo ServerRepository, twSvc TWService, pub ServerPublisher) *ServerService
func (*ServerService) GetNormalByVersionCodeAndServerKey ¶
func (*ServerService) List ¶
func (svc *ServerService) List(ctx context.Context, params domain.ListServersParams) (domain.ListServersResult, error)
func (*ServerService) ListAll ¶
func (svc *ServerService) ListAll(ctx context.Context, params domain.ListServersParams) (domain.Servers, error)
ListAll retrieves all servers from the database based on the given params in an optimal way. You can't specify a custom limit/cursor/sort for this operation.
func (*ServerService) ListAllOpen ¶
func (*ServerService) Sync ¶
func (svc *ServerService) Sync(ctx context.Context, payload domain.SyncServersCmdPayload) error
func (*ServerService) SyncConfigAndInfo ¶
func (svc *ServerService) SyncConfigAndInfo(ctx context.Context, payload domain.ServerSyncedEventPayload) error
func (*ServerService) UpdateEnnoblementDataSyncedAt ¶
func (svc *ServerService) UpdateEnnoblementDataSyncedAt( ctx context.Context, payload domain.EnnoblementsSyncedEventPayload, ) error
func (*ServerService) UpdateNumPlayers ¶
func (svc *ServerService) UpdateNumPlayers(ctx context.Context, payload domain.PlayersSyncedEventPayload) error
func (*ServerService) UpdateNumTribes ¶
func (svc *ServerService) UpdateNumTribes(ctx context.Context, payload domain.TribesSyncedEventPayload) error
func (*ServerService) UpdateNumVillages ¶
func (svc *ServerService) UpdateNumVillages(ctx context.Context, payload domain.VillagesSyncedEventPayload) error
func (*ServerService) UpdatePlayerSnapshotsCreatedAt ¶
func (svc *ServerService) UpdatePlayerSnapshotsCreatedAt( ctx context.Context, payload domain.SnapshotsCreatedEventPayload, ) error
func (*ServerService) UpdateSnapshotCreatedAt ¶ added in v1.1.0
func (svc *ServerService) UpdateSnapshotCreatedAt( ctx context.Context, key string, ) error
func (*ServerService) UpdateTribeSnapshotsCreatedAt ¶
func (svc *ServerService) UpdateTribeSnapshotsCreatedAt( ctx context.Context, payload domain.SnapshotsCreatedEventPayload, ) error
type ServerSnapshotRepository ¶ added in v1.1.0
type ServerSnapshotRepository interface { // Create persists tribe snapshots in a store (e.g. Postgres). // Duplicates are ignored. Create(ctx context.Context, params ...domain.CreateServerSnapshotParams) error }
type ServerSnapshotService ¶ added in v1.1.0
type ServerSnapshotService struct {
// contains filtered or unexported fields
}
func NewServerSnapshotService ¶ added in v1.1.0
func NewServerSnapshotService( repo ServerSnapshotRepository, serverSvc *ServerService, pub SnapshotPublisher, ) *ServerSnapshotService
func (*ServerSnapshotService) Create ¶ added in v1.1.0
func (svc *ServerSnapshotService) Create( ctx context.Context, createSnapshotsCmdPayload domain.CreateSnapshotsCmdPayload, ) error
type SnapshotPublisher ¶
type SnapshotPublisher interface { CmdCreate(ctx context.Context, payloads ...domain.CreateSnapshotsCmdPayload) error EventCreated(ctx context.Context, payloads ...domain.SnapshotsCreatedEventPayload) error }
type SnapshotService ¶
type SnapshotService struct {
// contains filtered or unexported fields
}
func NewSnapshotService ¶
func NewSnapshotService( versionSvc *VersionService, serverSvc *ServerService, serverSnapshotPub SnapshotPublisher, tribeSnapshotPub SnapshotPublisher, playerSnapshotPub SnapshotPublisher, ) *SnapshotService
type TWService ¶
type TWService interface { GetOpenServers(ctx context.Context, baseURL *url.URL) (domain.BaseServers, error) GetServerConfig(ctx context.Context, baseURL *url.URL) (domain.ServerConfig, error) GetUnitInfo(ctx context.Context, baseURL *url.URL) (domain.UnitInfo, error) GetBuildingInfo(ctx context.Context, baseURL *url.URL) (domain.BuildingInfo, error) GetTribes(ctx context.Context, baseURL *url.URL) (domain.BaseTribes, error) GetPlayers(ctx context.Context, baseURL *url.URL) (domain.BasePlayers, error) GetVillages(ctx context.Context, baseURL *url.URL) (domain.BaseVillages, error) GetEnnoblements(ctx context.Context, baseURL *url.URL, since time.Time) (domain.BaseEnnoblements, error) }
type TribeChangeRepository ¶
type TribeChangeRepository interface { // Create persists tribe changes in a store (e.g. Postgres). // Duplicates are ignored. Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error List(ctx context.Context, params domain.ListTribeChangesParams) (domain.ListTribeChangesResult, error) ListWithRelations( ctx context.Context, params domain.ListTribeChangesParams, ) (domain.ListTribeChangesWithRelationsResult, error) }
type TribeChangeService ¶
type TribeChangeService struct {
// contains filtered or unexported fields
}
func NewTribeChangeService ¶
func NewTribeChangeService(repo TribeChangeRepository) *TribeChangeService
func (*TribeChangeService) Create ¶
func (svc *TribeChangeService) Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error
func (*TribeChangeService) List ¶
func (svc *TribeChangeService) List( ctx context.Context, params domain.ListTribeChangesParams, ) (domain.ListTribeChangesResult, error)
func (*TribeChangeService) ListWithRelations ¶
func (svc *TribeChangeService) ListWithRelations( ctx context.Context, params domain.ListTribeChangesParams, ) (domain.ListTribeChangesWithRelationsResult, error)
type TribePublisher ¶
type TribePublisher interface {
EventSynced(ctx context.Context, payloads ...domain.TribesSyncedEventPayload) error
}
type TribeRepository ¶
type TribeRepository interface { CreateOrUpdate(ctx context.Context, params ...domain.CreateTribeParams) error UpdateDominance(ctx context.Context, serverKey string, numPlayerVillages int) error List(ctx context.Context, params domain.ListTribesParams) (domain.ListTribesResult, error) Count(ctx context.Context, params domain.CountTribesParams) (int, error) // Delete marks players with the given serverKey and ids as deleted (sets deleted at to now). // // https://en.wiktionary.org/wiki/soft_deletion Delete(ctx context.Context, serverKey string, ids ...int) error }
type TribeService ¶
type TribeService struct {
// contains filtered or unexported fields
}
func NewTribeService ¶
func NewTribeService(repo TribeRepository, twSvc TWService, pub TribePublisher) *TribeService
func (*TribeService) List ¶
func (svc *TribeService) List(ctx context.Context, params domain.ListTribesParams) (domain.ListTribesResult, error)
func (*TribeService) Sync ¶
func (svc *TribeService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
func (*TribeService) UpdateDominance ¶
func (svc *TribeService) UpdateDominance(ctx context.Context, payload domain.VillagesSyncedEventPayload) error
type TribeSnapshotRepository ¶
type TribeSnapshotRepository interface { // Create persists tribe snapshots in a store (e.g. Postgres). // Duplicates are ignored. Create(ctx context.Context, params ...domain.CreateTribeSnapshotParams) error ListWithRelations( ctx context.Context, params domain.ListTribeSnapshotsParams, ) (domain.ListTribeSnapshotsWithRelationsResult, error) Delete(ctx context.Context, serverKey string, dateLTE time.Time) error }
type TribeSnapshotService ¶
type TribeSnapshotService struct {
// contains filtered or unexported fields
}
func NewTribeSnapshotService ¶
func NewTribeSnapshotService( repo TribeSnapshotRepository, tribeSvc *TribeService, pub SnapshotPublisher, ) *TribeSnapshotService
func (*TribeSnapshotService) CleanUp ¶
func (svc *TribeSnapshotService) CleanUp(ctx context.Context, payload domain.CleanUpDataCmdPayload) error
func (*TribeSnapshotService) Create ¶
func (svc *TribeSnapshotService) Create( ctx context.Context, createSnapshotsCmdPayload domain.CreateSnapshotsCmdPayload, ) error
func (*TribeSnapshotService) ListWithRelations ¶
func (svc *TribeSnapshotService) ListWithRelations( ctx context.Context, params domain.ListTribeSnapshotsParams, ) (domain.ListTribeSnapshotsWithRelationsResult, error)
type VersionRepository ¶
type VersionRepository interface {
List(ctx context.Context, params domain.ListVersionsParams) (domain.ListVersionsResult, error)
}
type VersionService ¶
type VersionService struct {
// contains filtered or unexported fields
}
func NewVersionService ¶
func NewVersionService(repo VersionRepository) *VersionService
func (*VersionService) List ¶
func (svc *VersionService) List( ctx context.Context, params domain.ListVersionsParams, ) (domain.ListVersionsResult, error)
type VillagePublisher ¶
type VillagePublisher interface {
EventSynced(ctx context.Context, payloads ...domain.VillagesSyncedEventPayload) error
}
type VillageRepository ¶
type VillageRepository interface { CreateOrUpdate(ctx context.Context, params ...domain.CreateVillageParams) error List(ctx context.Context, params domain.ListVillagesParams) (domain.ListVillagesResult, error) ListWithRelations( ctx context.Context, params domain.ListVillagesParams, ) (domain.ListVillagesWithRelationsResult, error) Delete(ctx context.Context, serverKey string, ids ...int) error }
type VillageService ¶
type VillageService struct {
// contains filtered or unexported fields
}
func NewVillageService ¶
func NewVillageService(repo VillageRepository, twSvc TWService, pub VillagePublisher) *VillageService
func (*VillageService) GetWithRelations ¶
func (svc *VillageService) GetWithRelations( ctx context.Context, id int, serverKey string, ) (domain.VillageWithRelations, error)
func (*VillageService) List ¶
func (svc *VillageService) List( ctx context.Context, params domain.ListVillagesParams, ) (domain.ListVillagesResult, error)
func (*VillageService) ListWithRelations ¶
func (svc *VillageService) ListWithRelations( ctx context.Context, params domain.ListVillagesParams, ) (domain.ListVillagesWithRelationsResult, error)
func (*VillageService) Sync ¶
func (svc *VillageService) Sync(ctx context.Context, serverSyncedPayload domain.ServerSyncedEventPayload) error
Source Files ¶
- publishers.go
- service_data_cleanup.go
- service_data_sync.go
- service_ennoblement.go
- service_player.go
- service_player_snapshot.go
- service_server.go
- service_server_snapshot.go
- service_snapshot.go
- service_tribe.go
- service_tribe_change.go
- service_tribe_snapshot.go
- service_tw.go
- service_version.go
- service_village.go
Click to show internal directories.
Click to hide internal directories.