fixed displaying empty tables
This commit is contained in:
parent
19e94f036e
commit
47a14e6b82
6 changed files with 268 additions and 11 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"git.snrd.de/Spaenny/steamServer"
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type GamemodeStore struct {
|
||||
|
@ -27,3 +28,15 @@ func (s *GamemodeStore) Gamemodes() ([]steamServer.Gamemode, error) {
|
|||
}
|
||||
return gg, nil
|
||||
}
|
||||
|
||||
func (s *GamemodeStore) GamemodeCount(region_id uuid.UUID) ([]steamServer.GamemodeCount, error) {
|
||||
var c []steamServer.GamemodeCount
|
||||
var query = `SELECT DISTINCT servers.gamemode_id, COUNT(DISTINCT servers.id)
|
||||
FROM servers, gamemodes
|
||||
WHERE servers.region_id = $1
|
||||
GROUP BY servers.gamemode_id`
|
||||
if err := s.Select(&c, query, region_id); err != nil {
|
||||
return c, fmt.Errorf("error getting gamemode count: %w", err)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
|
Reference in a new issue