This repository has been archived on 2024-05-18. You can view files and clone it, but cannot push or open issues or pull requests.
steamServer/steamServer.go

70 lines
1.7 KiB
Go

package steamServer
import (
"github.com/google/uuid"
)
type Server struct {
ID uuid.UUID `db:"id"`
RegionID uuid.UUID `db:"region_id"`
GamemodeID uuid.UUID `db:"gamemode_id"`
AppID uint16 `db:"app_id"`
ServerIP string `db:"server_ip"`
Name string `db:"name"`
Map string `db:"map"`
Players uint8 `db:"players"`
MaxPlayers uint8 `db:"max_players"`
}
type Region struct {
ID uuid.UUID `db:"id"`
Name string `db:"name"`
}
type Gamemode struct {
ID uuid.UUID `db:"id"`
Name string `db:"name"`
}
type Flag struct {
ServerIP string `db:"server_ip"`
Flag string `db:"flag"`
}
type GamemodeCount struct {
ID uuid.UUID `db:"gamemode_id"`
Count int `db:"count"`
}
type ServerStore interface {
Server(id uuid.UUID) (Server, error)
Servers() ([]Server, error)
ServersByRegion(regionID uuid.UUID) ([]Server, error)
ServersByRegionAndGamemode(regionID uuid.UUID, gamemodeID uuid.UUID) ([]Server, error)
ServersByGamemode(gamemodeID uuid.UUID) ([]Server, error)
CreateServer(ser *Server) error
UpdateServerByQuery(ser *Server, server_ip string) error
}
type RegionStore interface {
Region(name string) (Region, error)
}
type GamemodeStore interface {
Gamemode(name string) (Gamemode, error)
Gamemodes() ([]Gamemode, error)
GamemodeCount(region_id uuid.UUID) ([]GamemodeCount, error)
}
type FlagStore interface {
Flag(server_ip string) (Flag, error)
Flags() ([]Flag, error)
}
type Store interface {
ServerStore
RegionStore
GamemodeStore
FlagStore
}