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
+5 -5
View File
@@ -24,7 +24,7 @@ type Repo interface {
LoadState() (game.Game, error)
}
type Ctrl struct {
type Controller struct {
param Param
Repo Repo
}
@@ -33,7 +33,7 @@ type Param struct {
StoragePath string
}
func NewController(configure func(*Param)) (*Ctrl, error) {
func NewController(configure func(*Param)) (*Controller, error) {
c := &Param{
StoragePath: ".",
}
@@ -44,13 +44,13 @@ func NewController(configure func(*Param)) (*Ctrl, error) {
if err != nil {
return nil, err
}
return &Ctrl{
return &Controller{
param: *c,
Repo: r,
}, nil
}
func (c *Ctrl) ExecuteInit(consumer func(Repo)) error {
func (c *Controller) ExecuteInit(consumer func(Repo)) error {
if err := c.Repo.Lock(); err != nil {
return fmt.Errorf("execute: lock failed: %s", err)
}
@@ -58,7 +58,7 @@ func (c *Ctrl) ExecuteInit(consumer func(Repo)) error {
return c.Repo.Release()
}
func (c *Ctrl) Execute(consumer func(Repo, game.Game)) error {
func (c *Controller) Execute(consumer func(Repo, game.Game)) error {
if err := c.Repo.Lock(); err != nil {
return fmt.Errorf("execute: lock failed: %s", err)
}