model

package
v0.0.0-...-90c44de Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompanyTypeDeveloper = "dev"
	CompanyTypePublisher = "pub"
)

company types

View Source
const (
	// ModerationStatusReady represents a game that is ready
	ModerationStatusReady = "ready"
	// ModerationStatusCheck represents a game that needs moderation
	ModerationStatusCheck = "check"
	// ModerationStatusRecheck represents a game that needs moderation after update
	ModerationStatusRecheck = "recheck"
)

Variables

This section is empty.

Functions

func GetGameSlug

func GetGameSlug(name string) string

GetGameSlug - returns game slug by name

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
	IGDBID           int64
	ModerationStatus string
}

CreateGameData - data for creating game in db

type CreateRating

type CreateRating struct {
	Rating uint8
	UserID string
	GameID int32
}

CreateRating represents data for rating a game

type File

type File struct {
	FileName string
	FileID   string
	FileURL  string
	Type     string
}

File represents an uploaded file

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"`
	IGDBID           int64      `db:"igdb_id"`
	ModerationStatus string     `db:"moderation_status"`
	Weight           float64    `db:"weight"` // Readonly field
}

Game - db game model

type GamesFilter

type GamesFilter struct {
	Name        string
	DeveloperID int32
	PublisherID int32
	GenreID     int32
	OrderBy     OrderBy
}

GamesFilter - games filter

type Genre

type Genre struct {
	ID     int32  `db:"id"`
	Name   string `db:"name"`
	IGDBID int64  `db:"igdb_id"`
}

Genre represents genre entity

type OrderBy

type OrderBy struct {
	Field string
	Order SortOrder
}

OrderBy type of ordering

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

type RemoveRating struct {
	UserID string
	GameID int32
}

RemoveRating represents data for removing game rating

type SortOrder

type SortOrder string

SortOrder - type for query sort order

const (
	AscendingSortOrder  SortOrder = "ASC"
	DescendingSortOrder SortOrder = "DESC"
)

SortOrder values

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 TaskInfo

type TaskInfo struct {
	Schedule string
	Fn       func() error
}

TaskInfo - task info

type TaskSettings

type TaskSettings []byte

TaskSettings task settings value

func (*TaskSettings) Scan

func (ts *TaskSettings) Scan(src interface{}) error

Scan implements sql.Scanner interface

func (TaskSettings) Value

func (ts TaskSettings) Value() (driver.Value, error)

Value implements driver.Valuer 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
	Developers       []int32
	Publishers       []int32
	ReleaseDate      string
	Genres           []int32
	LogoURL          string
	Summary          string
	Slug             string
	PlatformsIDs     []int32
	Screenshots      []string
	Websites         []string
	ModerationStatus string
	IGDBRating       float64
}

UpdateGameData - data for updating game in db

type UserRating

type UserRating struct {
	GameID int32  `db:"game_id"`
	UserID string `db:"user_id"`
	Rating uint8  `db:"rating"`
}

UserRating represents user rating entity

Jump to

Keyboard shortcuts

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