beatmapget

package
v0.0.0-...-0ab164d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

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

View Source
const Expire = time.Hour * 12

Expire is the duration after which a beatmap expires.

Variables

View Source
var Client *osuapi.Client

Client is the osu! api client to use

View Source
var DB *sqlx.DB

DB is the database.

View Source
var ErrBeatmapNotFound = errors.New("beatmapget: beatmap not found")

ErrBeatmapNotFound is returned by Beatmap if a beatmap could not be found.

Functions

func Beatmap

func Beatmap(b int) (int, error)

Beatmap check if an update is required for all beatmaps in the set containing this beatmap.

func Set

func Set(s int) error

Set checks if an update is required for all beatmaps in a set.

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

type BeatmapDefiningQuality struct {
	ID  int
	MD5 string
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

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