mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-06 21:15:51 +08:00
12 lines
278 B
Go
12 lines
278 B
Go
package db
|
|
|
|
func FetchPlayerCount() (int, error) {
|
|
var playerCount int
|
|
err := handle.QueryRow("SELECT COUNT(*) FROM accounts WHERE lastActivity > DATE_SUB(UTC_TIMESTAMP(), INTERVAL 5 MINUTE)").Scan(&playerCount)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
|
|
return playerCount, nil
|
|
}
|