Documentation ¶
Overview ¶
Package models contains everything that is needed to interface to the database CheeseGull is using.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BiggestSetID ¶
BiggestSetID retrieves the biggest set ID in the sets database. This is used by discovery to have a starting point from which to discover new beatmaps.
func CreateBeatmaps ¶
CreateBeatmaps adds beatmaps in the database.
func RunMigrations ¶
RunMigrations brings the database up to date following the migrations.
Types ¶
type Beatmap ¶
type Beatmap struct { ID int `json:"BeatmapID"` ParentSetID int DiffName string FileMD5 string Mode int BPM float64 AR float32 OD float32 CS float32 HP float32 TotalLength int HitLength int Playcount int Passcount int MaxCombo int DifficultyRating float64 }
Beatmap represents a single beatmap (difficulty) on osu!.
type SearchOptions ¶
type SearchOptions struct { // If len is 0, then it should be treated as if all statuses are good. Status []int Query string // Gamemodes to which limit the results. If len is 0, it means all modes // are ok. Mode []int // Pagination options. Offset int Amount int }
SearchOptions are options that can be passed to SearchSets for filtering sets.
type Set ¶
type Set struct { ID int `json:"SetID"` ChildrenBeatmaps []Beatmap RankedStatus int ApprovedDate time.Time LastUpdate time.Time LastChecked time.Time Artist string Title string Creator string Source string Tags string HasVideo bool Genre int Language int Favourites int }
Set represents a set of beatmaps usually sharing the same song.
func FetchSetsForBatchUpdate ¶
FetchSetsForBatchUpdate fetches limit sets from the database, sorted by LastChecked (asc, older first). Results are further filtered: if the set's RankedStatus is 3, 0 or -1 (qualified, pending or WIP), at least 30 minutes must have passed from LastChecked. For all other statuses, at least 4 days must have passed from LastChecked.
func SearchSets ¶
func SearchSets(db, searchDB *sql.DB, opts SearchOptions) ([]Set, error)
SearchSets retrieves sets, filtering them using SearchOptions.