Add endpoints for stats

This commit is contained in:
Flashfyre committed 2024-04-06 18:15:47 -04:00
1 parent 99d3490172
commit dcb1c76370
5 files changed
+74 -7

No files matched your search

+20
View File
@@ -9,3 +9,23 @@ func FetchPlayerCount() (int, error) {
return playerCount, nil
}
func FetchBattleCount() (int, error) {
var battleCount int
err := handle.QueryRow("SELECT SUM(battles) FROM accountStats").Scan(&battleCount)
if err != nil {
return 0, err
}
return battleCount, nil
}
func FetchClassicSessionCount() (int, error) {
var classicSessionCount int
err := handle.QueryRow("SELECT SUM(classicSessionsPlayed) FROM accountStats").Scan(&classicSessionCount)
if err != nil {
return 0, err
}
return classicSessionCount, nil
}