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

71 lines
1.7 KiB
Go
Raw Normal View History

2021-09-20 14:57:24 +02:00
package steamServer
import (
"github.com/google/uuid"
)
2021-09-20 14:57:24 +02:00
type Server struct {
ID uuid.UUID `db:"id"`
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"`
ServerIP string `db:"server_ip"`
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"`
}
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)
Servers() ([]Server, error)
2021-09-20 22:55:12 +02:00
ServersByRegion(regionID uuid.UUID) ([]Server, error)
ServersByRegionAndGamemode(regionID uuid.UUID, gamemodeID uuid.UUID) ([]Server, error)
2021-09-20 22:55:12 +02:00
ServersByGamemode(gamemodeID uuid.UUID) ([]Server, error)
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
}
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-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
GamemodeStore
2021-09-23 15:58:56 +02:00
FlagStore
2021-09-20 14:57:24 +02:00
}