Add endpoints for stats
This commit is contained in:
1 parent
99d3490172
commit
dcb1c76370
5 files changed
+74
-7
No files matched your search
+20
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user