Documentation ¶
Overview ¶
Package beatmapget is an helper package to retrieve beatmap information from the osu! API, if the beatmap in the database is too old.
Index ¶
Constants ¶
const Expire = time.Hour * 12
Expire is the duration after which a beatmap expires.
Variables ¶
var Client *osuapi.Client
Client is the osu! api client to use
var DB *sqlx.DB
DB is the database.
var ErrBeatmapNotFound = errors.New("beatmapget: beatmap not found")
ErrBeatmapNotFound is returned by Beatmap if a beatmap could not be found.
Functions ¶
func Beatmap ¶
Beatmap check if an update is required for all beatmaps in the set containing this beatmap.
func Update ¶
func Update(b BeatmapDefiningQuality, beatmapInDB bool) error
Update updates a beatmap.
func UpdateIfRequired ¶
func UpdateIfRequired(b BeatmapDefiningQuality) error
UpdateIfRequired updates the beatmap in the database if an update is required.
func UpdateRequired ¶
func UpdateRequired(b *BeatmapDefiningQuality) (bool, error)
UpdateRequired checks an update is required. If error is sql.ErrNoRows, it means that the beatmap should be updated, and that there was not the beatmap in the database previously.
Types ¶
type BeatmapDefiningQuality ¶
BeatmapDefiningQuality is the defining quality of the beatmap to be updated, which is to say either the ID, the set ID or the md5 hash.
func (BeatmapDefiningQuality) String ¶
func (b BeatmapDefiningQuality) String() string