Documentation
¶
Index ¶
Constants ¶
View Source
const (
// FetchIGDBGamesTaskName ...
FetchIGDBGamesTaskName = "fetch_igdb_games"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IGDBAPIClient ¶
type IGDBAPIClient interface { GetTopRatedGames(ctx context.Context, platformsIDs []int64, releasedAfter time.Time, minRatingsCount, minRating, limit int64) ([]igdbapi.TopRatedGamesResp, error) GetImageByURL(ctx context.Context, imageURL, imageType string) (igdbapi.GetImageResp, error) }
IGDBAPIClient igdb api client 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 { BeginTx(ctx context.Context) (pgx.Tx, error) GetTask(ctx context.Context, tx pgx.Tx, name string) (model.Task, error) UpdateTask(ctx context.Context, tx pgx.Tx, task model.Task) error CreateGame(ctx context.Context, cgd model.CreateGameData) (id int32, err error) GetGameIDByIGDBID(ctx context.Context, igdbID int64) (id int32, 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) CreateCompany(ctx context.Context, c model.Company) (int32, error) GetCompanies(ctx context.Context) ([]model.Company, 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) *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
Click to show internal directories.
Click to hide internal directories.