2021-09-20 14:57:24 +02:00
|
|
|
package steamServer
|
|
|
|
|
2021-09-22 14:12:49 +02:00
|
|
|
import (
|
|
|
|
"github.com/google/uuid"
|
|
|
|
)
|
2021-09-20 14:57:24 +02:00
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
ID uuid.UUID `db:"id"`
|
2021-09-20 17:31:41 +02:00
|
|
|
RegionID uuid.UUID `db:"region_id"`
|
|
|
|
GamemodeID uuid.UUID `db:"gamemode_id"`
|
2021-09-23 15:58:56 +02:00
|
|
|
AppID uint16 `db:"app_id"`
|
2021-09-20 18:44:08 +02:00
|
|
|
ServerIP string `db:"server_ip"`
|
2021-09-20 17:31:41 +02:00
|
|
|
Name string `db:"name"`
|
|
|
|
Map string `db:"map"`
|
2021-09-23 15:58:56 +02:00
|
|
|
Players uint8 `db:"players"`
|
|
|
|
MaxPlayers uint8 `db:"max_players"`
|
2021-09-20 14:57:24 +02:00
|
|
|
}
|
|
|
|
|
2021-09-20 22:55:12 +02:00
|
|
|
type Region struct {
|
|
|
|
ID uuid.UUID `db:"id"`
|
|
|
|
Name string `db:"name"`
|
|
|
|
}
|
|
|
|
|
2021-09-22 14:12:49 +02:00
|
|
|
type Gamemode struct {
|
|
|
|
ID uuid.UUID `db:"id"`
|
|
|
|
Name string `db:"name"`
|
|
|
|
}
|
|
|
|
|
2021-09-23 15:58:56 +02:00
|
|
|
type Flag struct {
|
|
|
|
ServerIP string `db:"server_ip"`
|
|
|
|
Flag string `db:"flag"`
|
|
|
|
}
|
|
|
|
|
2021-09-24 13:19:44 +02:00
|
|
|
type GamemodeCount struct {
|
|
|
|
ID uuid.UUID `db:"gamemode_id"`
|
|
|
|
Count int `db:"count"`
|
|
|
|
}
|
|
|
|
|
2021-09-20 14:57:24 +02:00
|
|
|
type ServerStore interface {
|
|
|
|
Server(id uuid.UUID) (Server, error)
|
2021-09-20 17:31:41 +02:00
|
|
|
Servers() ([]Server, error)
|
2021-09-20 22:55:12 +02:00
|
|
|
ServersByRegion(regionID uuid.UUID) ([]Server, error)
|
2021-09-22 14:12:49 +02:00
|
|
|
ServersByRegionAndGamemode(regionID uuid.UUID, gamemodeID uuid.UUID) ([]Server, error)
|
2021-09-20 22:55:12 +02:00
|
|
|
ServersByGamemode(gamemodeID uuid.UUID) ([]Server, error)
|
2021-09-20 17:31:41 +02:00
|
|
|
CreateServer(ser *Server) error
|
2021-09-20 22:55:12 +02:00
|
|
|
UpdateServerByQuery(ser *Server, server_ip string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type RegionStore interface {
|
|
|
|
Region(name string) (Region, error)
|
2021-09-20 14:57:24 +02:00
|
|
|
}
|
|
|
|
|
2021-09-22 14:12:49 +02:00
|
|
|
type GamemodeStore interface {
|
|
|
|
Gamemode(name string) (Gamemode, error)
|
|
|
|
Gamemodes() ([]Gamemode, error)
|
2021-09-24 13:19:44 +02:00
|
|
|
GamemodeCount(region_id uuid.UUID) ([]GamemodeCount, error)
|
2021-09-22 14:12:49 +02:00
|
|
|
}
|
|
|
|
|
2021-09-23 15:58:56 +02:00
|
|
|
type FlagStore interface {
|
|
|
|
Flag(server_ip string) (Flag, error)
|
|
|
|
Flags() ([]Flag, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-20 14:57:24 +02:00
|
|
|
type Store interface {
|
|
|
|
ServerStore
|
2021-09-20 22:55:12 +02:00
|
|
|
RegionStore
|
2021-09-22 14:12:49 +02:00
|
|
|
GamemodeStore
|
2021-09-23 15:58:56 +02:00
|
|
|
FlagStore
|
2021-09-20 14:57:24 +02:00
|
|
|
}
|