knowyt/server/src/application/getGame.go

18 lines
272 B
Go

package application
import (
"fmt"
"sirlab.de/go/knowyt/game"
)
func (app Application) GetGameById(id string) (*game.Game, error) {
app.mu.Lock()
defer app.mu.Unlock()
gm := app.games[id]
if gm == nil {
return nil, fmt.Errorf("unknown id")
}
return gm, nil
}