Documentation
¶
Index ¶
Constants ¶
View Source
const (
// FetchIGDBGamesTaskName task name for fetching games from igdb
FetchIGDBGamesTaskName = "fetch_igdb_games"
)
View Source
const (
// ProcessModerationTaskName task name for processing game moderation
ProcessModerationTaskName = "process_moderation"
)
View Source
const (
// UpdateGameInfoTaskName task name for updating trending index
UpdateGameInfoTaskName = "update_game_info"
)
View Source
const (
// UpdateTrendingIndexTaskName task name for updating trending index
UpdateTrendingIndexTaskName = "update_trending_index"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GameFacade ¶
type GameFacade interface {
CreateCompany(ctx context.Context, company model.Company) (int32, error)
UpdateGameIGDBInfo(ctx context.Context, gameID int32, data model.UpdateGameIGDBData) error
UpdateGameTrendingIndex(ctx context.Context, gameID int32) error
}
GameFacade game facade interface
type IGDBAPIClient ¶
type IGDBAPIClient interface {
GetTopRatedGames(ctx context.Context, platformsIDs []int64, releasedAfter time.Time, minRatingsCount, minRating, limit int64) ([]igdbapi.TopRatedGames, error)
GetImageByURL(ctx context.Context, imageURL, imageType string) (igdbapi.GetImageResp, error)
GetGameInfoForUpdate(ctx context.Context, igdbID int64) (igdbapi.GameInfoForUpdate, error)
}
IGDBAPIClient igdb api client interface
type ModerationFacade ¶
ModerationFacade moderation facade interface
type S3Client ¶
type S3Client interface {
Upload(ctx context.Context, data io.ReadSeeker, contentType string, md map[string]string) (s3.UploadResult, error)
}
S3Client s3 store client interface
type Storage ¶
type Storage interface {
RunWithTx(ctx context.Context, f func(context.Context) error) error
GetTask(ctx context.Context, name string) (model.Task, error)
UpdateTask(ctx context.Context, task model.Task) error
CreateGame(ctx context.Context, cgd model.CreateGameData) (id int32, err error)
GetGamesIGDBIDMap(ctx context.Context) (map[int64]int32, error)
GetGameByID(ctx context.Context, id int32) (game model.Game, err error)
GetPlatforms(ctx context.Context) ([]model.Platform, error)
CreateGenre(ctx context.Context, g model.Genre) (int32, error)
GetGenres(ctx context.Context) ([]model.Genre, error)
GetCompanies(ctx context.Context) ([]model.Company, error)
GetGamesIDsAfterID(ctx context.Context, lastID int32, batchSize int) ([]int32, error)
GetPendingModerationGameIDs(ctx context.Context, limit int) ([]model.ModerationIDGameID, error)
SetModerationRecordsStatus(ctx context.Context, gameIDs []int32, status model.ModerationStatus) error
}
Storage db storage interface
type TaskProvider ¶
type TaskProvider struct {
// contains filtered or unexported fields
}
TaskProvider contains dependencies for tasks
func New ¶
func New(log *zap.Logger, storage Storage, igdbClient IGDBAPIClient, s3Client S3Client, gameFacade GameFacade, moderationFacade ModerationFacade) *TaskProvider
New creates new TaskProvider
func (*TaskProvider) DoTask ¶
func (tp *TaskProvider) DoTask(name string, taskFn func(ctx context.Context, settings model.TaskSettings) (newSettings model.TaskSettings, err error)) error
DoTask - runs task. name - name of a task to run. taskFn - function to be run: it accepts settings and returns updates settings
func (*TaskProvider) StartFetchIGDBGames ¶
func (tp *TaskProvider) StartFetchIGDBGames() error
StartFetchIGDBGames starts fetch igdb games task
func (*TaskProvider) StartProcessModeration ¶
func (tp *TaskProvider) StartProcessModeration() error
StartProcessModeration starts the process moderation task
func (*TaskProvider) StartUpdateGameInfo ¶
func (tp *TaskProvider) StartUpdateGameInfo() error
StartUpdateGameInfo starts the update game info task
func (*TaskProvider) StartUpdateTrendingIndex ¶
func (tp *TaskProvider) StartUpdateTrendingIndex() error
StartUpdateTrendingIndex starts the update trending index task
Source Files
¶
Click to show internal directories.
Click to hide internal directories.