Documentation ¶
Index ¶
- Constants
- Variables
- func CountClues() (int64, error)
- func GetCategoryClueCount(categoryID int64) (int64, error)
- func GetCategoryGameCount(categoryID int64) (int64, error)
- func InsertClue(c *Clue) error
- func InsertGame(g *Game) error
- func InsertSeason(s *Season) error
- func UpdateCategory(c *Category) error
- func UpdateClue(c *Clue) error
- type Category
- func GetCategories(limit int64) ([]Category, error)
- func GetCategoriesForGame(gameID int64) ([]Category, error)
- func GetCategory(categoryID int64) (*Category, error)
- func GetCategoryByName(categoryName string) (*Category, error)
- func GetRandomCategory() (*Category, error)
- func GetRandomCategoryMany(limit int64) ([]Category, error)
- func InsertCategory(name string) (*Category, error)
- type Clue
- type CluesParams
- type Game
- type JeppDB
- type Round
- type Season
Constants ¶
const TIME_FORMAT = "Monday, January 2, 2006"
TIME_FORMAT is the format used for friendly date strings. This is the format used by j-archive.
Variables ¶
var RoundMap = map[string]int{ "J": int(Jeopardy), "DJ": int(DoubleJeopardy), "FJ": int(FinalJeopardy), "TB": int(FinalJeopardy), }
Functions ¶
func CountClues ¶ added in v0.0.4
CountClues returns the number of clues in the database.
func GetCategoryClueCount ¶
GetCategoryClueCount returns the number of clues a category has appeared in.
func GetCategoryGameCount ¶
GetCategoryGameCount returns the number of games a category has appeared in.
func InsertSeason ¶
InsertSeason inserts a season into the database.
func UpdateCategory ¶
UpdateCategory updates a category in the database.
Types ¶
type Category ¶
type Category struct { CategoryID int64 `db:"category_id" json:"categoryId" example:"765"` Name string `db:"name" json:"name" example:"State Capitals"` }
Category represents a jeopardy category in the database.
func GetCategories ¶
GetCategories returns all categories in the database.
func GetCategoriesForGame ¶
GetCategoriesForGame returns all categories for a given game.
func GetCategory ¶
GetCategory returns the category with the given ID.
func GetCategoryByName ¶
func GetRandomCategory ¶
GetRandomCategory returns a single category from the database.
func GetRandomCategoryMany ¶ added in v0.0.9
GetRandomCategoryMany returns `limit` random categories from the database.
func InsertCategory ¶
InsertCategory inserts a category into the database.
type Clue ¶
type Clue struct { ClueID int64 `db:"clue_id" json:"clueId" example:"804002032"` GameID int64 `db:"game_id" json:"gameId" example:"8040"` CategoryID int64 `db:"category_id" json:"categoryId" example:"3462"` Question string `db:"question" json:"question" example:"This is the question."` Answer string `db:"answer" json:"answer" example:"This is the answer."` }
Clue represents a jeopardy clue in the database.
func GetClues ¶
func GetClues(params CluesParams) ([]Clue, error)
ListClues returns a list of clues in the database, defaults to returning values ordered by game id descending.
func GetRandomClue ¶
GetClue returns a single clue from the database.
func GetRandomClueMany ¶ added in v0.0.9
GetRandomClueMany returns `limit` random clues from the database.
type Game ¶
type Game struct { GameID int64 `db:"game_id" json:"gameId" example:"8040"` SeasonID int64 `db:"season_id" json:"seasonId" example:"38"` ShowNum int64 `db:"show_num" json:"showNum" example:"4532"` GameDate time.Time `db:"game_date" json:"gameDate" example:"2019-01-01"` TapedDate time.Time `db:"taped_date" json:"tapedDate" example:"2019-01-01"` }
Game represents a single game of Jeopardy.
func GetGames ¶
GetGames returns a list of games in the database, defaults to returning values ordered by game date, with most recent first, limited to 100 results.
TODO: have this take a "lastClueID" arg or something for dumb pagination.
func GetGamesBySeason ¶
GetGamesBySeason returns a list of games in the database for a given season.
func GetRandomGame ¶
GetRandomGame returns a single game from the database.
func GetRandomGameMany ¶ added in v0.0.9
GetRandomGameMany returns `limit` random games from the database.
type JeppDB ¶
func NewTestJeppDB ¶ added in v0.2.0
func NewTestJeppDB() *JeppDB
type Round ¶
type Round int // 0 = Jeopardy, 1 = Double Jeopardy, 2 = Final Jeopardy
TODO: this is silly, should fix it
type Season ¶
type Season struct { SeasonID int64 `db:"season_id" json:"seasonId" example:"38"` StartDate time.Time `db:"start_date" json:"startDate" example:"2001-09-03T00:00:00Z"` EndDate time.Time `db:"end_date" json:"endDate" example:"2002-07-26T00:00:00Z"` }
func GetSeasons ¶
GetSeasons returns a list of seasons in the database, defaults to returning values ordered by season id, with most recent first.