2016-05-18 16:37:36 +00:00
|
|
|
package peppy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
2016-08-15 11:45:42 +00:00
|
|
|
"github.com/jmoiron/sqlx"
|
2016-05-18 16:37:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// GetBeatmap retrieves general beatmap information.
|
2016-08-15 11:45:42 +00:00
|
|
|
func GetBeatmap(c *gin.Context, db *sqlx.DB) {
|
2016-05-18 16:37:36 +00:00
|
|
|
var whereClauses []string
|
|
|
|
var params []string
|
|
|
|
|
|
|
|
// since value is not stored, silently ignore
|
|
|
|
if c.Query("s") != "" {
|
|
|
|
whereClauses = append(whereClauses, "beatmaps.beatmapset_id = ?")
|
|
|
|
params = append(params, c.Query("s"))
|
|
|
|
}
|
|
|
|
if c.Query("b") != "" {
|
|
|
|
whereClauses = append(whereClauses, "beatmaps.beatmap_id = ?")
|
|
|
|
params = append(params, c.Query("b"))
|
|
|
|
}
|
|
|
|
if c.Query("u") != "" {
|
|
|
|
wc, p := genUser(c, db)
|
|
|
|
whereClauses = append(whereClauses, wc)
|
|
|
|
params = append(params, p)
|
|
|
|
}
|
|
|
|
// silently ignore m
|
|
|
|
// silently ignore a
|
|
|
|
if c.Query("h") != "" {
|
|
|
|
whereClauses = append(whereClauses, "beatmaps.beatmap_md5 = ?")
|
|
|
|
params = append(params, c.Query("h"))
|
|
|
|
}
|
|
|
|
|
|
|
|
//bm := osuapi.Beatmap{}
|
|
|
|
|
|
|
|
//db.Query("SELECT beatmaps.beatmapset_id, beatmaps.beatmap FROM ")
|
|
|
|
}
|