Documentation
¶
Index ¶
- Constants
- Variables
- func GetGameSlug(name string) string
- type Company
- type CreateGame
- type CreateGameData
- type CreateModeration
- type CreateRating
- type File
- type Game
- type GameModerationData
- type GameTrendingData
- type GamesFilter
- type Genre
- type Moderation
- type ModerationData
- type ModerationIDGameID
- type ModerationStatus
- type OrderBy
- type Platform
- type RemoveRating
- type SortOrder
- type Task
- type TaskInfo
- type TaskSettings
- type TaskStatus
- type UpdateGame
- type UpdateGameData
- type UpdateGameIGDBData
- type UpdateModerationResult
- type UserRating
Constants ¶
const ( CompanyTypeDeveloper = "dev" CompanyTypePublisher = "pub" )
company types
Variables ¶
var ( OrderGamesByDefault = OrderBy{ Field: "trending_index", Order: DescendingSortOrder, } OrderGamesByReleaseDate = OrderBy{ Field: "release_date", Order: DescendingSortOrder, } OrderGamesByName = OrderBy{ Field: "name", Order: AscendingSortOrder, } OrderGamesByRating = OrderBy{ Field: "rating", Order: DescendingSortOrder, } )
OrderGamesBy options
Functions ¶
Types ¶
type Company ¶
type Company struct {
ID int32 `db:"id"`
Name string `db:"name"`
IGDBID sql.NullInt64 `db:"igdb_id"`
}
Company represents company entity
type CreateGame ¶
type CreateGame struct {
Name string
ReleaseDate string
GenresIDs []int32
LogoURL string
Summary string
Slug string
PlatformsIDs []int32
Screenshots []string
Websites []string
Developer string // helper field
Publisher string // helper field
}
CreateGame - create game data
func (CreateGame) MapToCreateGameData ¶
func (cg CreateGame) MapToCreateGameData(publisherID, developerID int32) CreateGameData
MapToCreateGameData maps CreateGame to CreateGameData
type CreateGameData ¶
type CreateGameData struct {
Name string
DevelopersIDs []int32
PublishersIDs []int32
ReleaseDate string
GenresIDs []int32
LogoURL string
Summary string
Slug string
PlatformsIDs []int32
Screenshots []string
Websites []string
IGDBRating float64
IGDBRatingCount int32
IGDBID int64
ModerationStatus ModerationStatus
}
CreateGameData - data for creating game in db
type CreateModeration ¶
type CreateModeration struct {
GameID int32
GameData ModerationData
Status ModerationStatus
}
CreateModeration represents data required to create moderation record
func NewCreateModeration ¶
func NewCreateModeration(gameID int32, gameData ModerationData) CreateModeration
NewCreateModeration creates new CreateModeration
type CreateRating ¶
CreateRating represents data for rating a game
type Game ¶
type Game struct {
ID int32 `db:"id"`
Name string `db:"name"`
DevelopersIDs []int32 `db:"developers"`
PublishersIDs []int32 `db:"publishers"`
ReleaseDate types.Date `db:"release_date"`
GenresIDs []int32 `db:"genres"`
LogoURL string `db:"logo_url"`
Rating float64 `db:"rating"`
Summary string `db:"summary"`
Slug string `db:"slug"`
PlatformsIDs []int32 `db:"platforms"`
Screenshots []string `db:"screenshots"`
Websites []string `db:"websites"`
IGDBRating float64 `db:"igdb_rating"`
IGDBRatingCount int32 `db:"igdb_rating_count"`
IGDBID int64 `db:"igdb_id"`
ModerationStatus ModerationStatus `db:"moderation_status"`
ModerationID sql.NullInt32 `db:"moderation_id"`
TrendingIndex float64 `db:"trending_index"`
}
Game - db game model
type GameModerationData ¶
type GameModerationData struct {
Game Game
Moderations []Moderation
}
GameModerationData aggregates a game with its moderation history
type GameTrendingData ¶
type GameTrendingData struct {
Year int `db:"release_year"`
Month int `db:"release_month"`
IGDBRating float64 `db:"igdb_rating"`
IGDBRatingCount int32 `db:"igdb_rating_count"`
Rating float64 `db:"rating"`
RatingCount int32 `db:"rating_count"`
}
GameTrendingData contains data needed for trending index calculation
type GamesFilter ¶
type GamesFilter struct {
Name string
DeveloperID int32
PublisherID int32
GenreID int32
OrderBy OrderBy
}
GamesFilter - games filter
type Moderation ¶
type Moderation struct {
ID int32 `db:"id"`
GameID int32 `db:"game_id"`
Status string `db:"status"`
Details string `db:"details"`
Attempts int32 `db:"attempts"`
GameData ModerationData `db:"game_data"`
CreatedAt sql.NullTime `db:"created_at"`
UpdatedAt sql.NullTime `db:"updated_at"`
}
Moderation represents stored moderation record
type ModerationData ¶
type ModerationData struct {
Name string `json:"name"`
Developers []string `json:"developers"`
Publisher string `json:"publisher"`
ReleaseDate string `json:"releaseDate"`
Genres []string `json:"genres"`
LogoURL string `json:"logoUrl"`
Summary string `json:"summary"`
Screenshots []string `json:"screenshots"`
Websites []string `json:"websites"`
}
ModerationData represents game data for moderation
func (*ModerationData) Scan ¶
func (md *ModerationData) Scan(src interface{}) error
Scan implements sql.Scanner for ModerationData
type ModerationIDGameID ¶
ModerationIDGameID represents moderation record id and game id
type ModerationStatus ¶
type ModerationStatus string
ModerationStatus represents moderation status of a game
const ( // ModerationStatusPending represents a game that needs moderation ModerationStatusPending ModerationStatus = "pending" // ModerationStatusInProgress represents a game that is being moderated at the moment ModerationStatusInProgress ModerationStatus = "in_progress" // ModerationStatusReady represents a game that is ready ModerationStatusReady ModerationStatus = "ready" // ModerationStatusDeclined represents a game that is declined and requires fixing ModerationStatusDeclined ModerationStatus = "declined" // ModerationStatusFailed represents a game with a failed moderation ModerationStatusFailed ModerationStatus = "failed" )
type Platform ¶
type Platform struct {
ID int32 `db:"id"`
Name string `db:"name"`
Abbreviation string `db:"abbreviation"`
IGDBID int64 `db:"igdb_id"`
}
Platform represents platform entity
type RemoveRating ¶
RemoveRating represents data for removing game rating
type Task ¶
type Task struct {
Name string `db:"name"`
Status TaskStatus `db:"status"`
RunCount int64 `db:"run_count"`
LastRun sql.NullTime `db:"last_run"`
Settings TaskSettings `db:"settings"`
}
Task represents task entity
type TaskSettings ¶
type TaskSettings []byte
TaskSettings task settings value
func (*TaskSettings) Scan ¶
func (ts *TaskSettings) Scan(src interface{}) error
Scan implements sql.Scanner interface
type TaskStatus ¶
type TaskStatus string
TaskStatus represents task status type
const ( IdleTaskStatus TaskStatus = "idle" RunningTaskStatus TaskStatus = "running" ErrorTaskStatus TaskStatus = "error" )
Task status values
type UpdateGame ¶
type UpdateGame struct {
Name *string
Developer *string
Publisher string
ReleaseDate *string
GenresIDs *[]int32
LogoURL *string
Summary *string
PlatformsIDs *[]int32
Screenshots *[]string
Websites *[]string
}
UpdateGame - update game fields
func (UpdateGame) MapToUpdateGameData ¶
func (ug UpdateGame) MapToUpdateGameData(g Game, developersIDs []int32) UpdateGameData
MapToUpdateGameData maps UpdateGame and Game to UpdateGameData
type UpdateGameData ¶
type UpdateGameData struct {
Name string
DevelopersIDs []int32
PublishersIDs []int32
ReleaseDate string
GenresIDs []int32
LogoURL string
Summary string
Slug string
PlatformsIDs []int32
Screenshots []string
Websites []string
ModerationStatus ModerationStatus
}
UpdateGameData - data for updating game in db
type UpdateGameIGDBData ¶
type UpdateGameIGDBData struct {
Name string
PlatformsIDs []int32
Websites []string
IGDBRating float64
IGDBRatingCount int32
}
UpdateGameIGDBData - igdb data for updating game in db
type UpdateModerationResult ¶
type UpdateModerationResult struct {
ResultStatus ModerationStatus
Details string
}
UpdateModerationResult represents data to update moderation result
type UserRating ¶
type UserRating struct {
GameID int32 `db:"game_id"`
UserID string `db:"user_id"`
Rating uint8 `db:"rating"`
}
UserRating represents user rating entity