chore: refactor structure

This commit is contained in:
Ilia Denisov
2025-11-21 22:06:40 +03:00
parent 269de2184c
commit 1bdb40a27d
8 changed files with 18 additions and 18 deletions
+3 -3
View File
@@ -7,18 +7,18 @@ import (
)
func LoadState(configure func(*controller.Param)) (g game.Game, err error) {
control(configure, func(c *controller.Ctrl) { c.ExecuteInit(func(r controller.Repo) { g, err = c.Repo.LoadState() }) })
control(configure, func(c *controller.Controller) { c.ExecuteInit(func(r controller.Repo) { g, err = c.Repo.LoadState() }) })
return
}
func GenerateGame(configure func(*controller.Param), races []string) (gameID uuid.UUID, err error) {
control(configure, func(c *controller.Ctrl) {
control(configure, func(c *controller.Controller) {
c.ExecuteInit(func(r controller.Repo) { gameID, err = controller.NewGame(r, races) })
})
return
}
func control(configure func(*controller.Param), consumer func(*controller.Ctrl)) error {
func control(configure func(*controller.Param), consumer func(*controller.Controller)) error {
c, err := controller.NewController(configure)
if err != nil {
return err