game

package
v0.0.0-...-6f83e94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGameNotFound = errors.New("game not found")
)

Repository errors

Functions

This section is empty.

Types

type Game

type Game struct {
	ID         string   `json:"id" example:"123123"`
	LastMoveBy uint8    `json:"last_move_by" enums:"1,2" example:"1"`
	BoardCells [9]uint8 `json:"board_cells" example:"0,1,0,2,2,0,1,1,0"`
}

Game represents a game

func (*Game) Validate

func (g *Game) Validate() error

Validate validates the game

type Repository

type Repository interface {
	// LoadGame returns a game from a game id
	LoadGame(ctx context.Context, id string) (*Game, error)

	// SaveGame saves a game
	SaveGame(ctx context.Context, g Game) error
}

Repository represents a game repository interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL