refactor: executors and routers

* refactor: executors and routers
This commit is contained in:
Ilia Denisov
2026-02-09 15:53:34 +03:00
committed by GitHub
parent e48a0c8b96
commit d9c8de27e5
38 changed files with 508 additions and 838 deletions
+25 -7
View File
@@ -1,6 +1,24 @@
package game
import "github.com/google/uuid"
import (
"strings"
"github.com/google/uuid"
)
type Relation string
const (
RelationWar Relation = "War"
RelationPeace Relation = "Peace"
)
var (
relationSet = map[string]Relation{
strings.ToLower(RelationWar.String()): RelationWar,
strings.ToLower(RelationPeace.String()): RelationPeace,
}
)
type Race struct {
ID uuid.UUID `json:"id"`
@@ -15,17 +33,17 @@ type Race struct {
ShipTypes []ShipType `json:"shipType,omitempty"`
}
type Relation string
func ParseRelation(v string) (Relation, bool) {
if v, ok := relationSet[strings.ToLower(v)]; ok {
return v, ok
}
return Relation(""), false
}
func (r Relation) String() string {
return string(r)
}
const (
RelationWar Relation = "War"
RelationPeace Relation = "Peace"
)
type RaceRelation struct {
RaceID uuid.UUID `json:"raceId"`
Relation Relation `json:"relation"`