game

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarsClient

type MarsClient interface {
	CreateGame(ctx context.Context, game mars.CreateGameRequest) (mars.CreateGameResponse, error)
	GetPlayerUrl(playerId string) string
	WaitingFor(ctx context.Context, req mars.WaitingForRequest) (mars.WaitingForResponse, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(storage Storage, mars MarsClient) *Service

func (*Service) CreateGame

func (s *Service) CreateGame(ctx context.Context, users []*storage.User) error

func (*Service) GetUserGames

func (s *Service) GetUserGames(ctx context.Context, userId string) ([]*UserGame, error)

type Storage

type Storage interface {
	CreateGame(ctx context.Context, game *storage.Game) error
	GetGamesByUserId(ctx context.Context, userId string) ([]*storage.Game, error)
}

type UserGame

type UserGame struct {
	PlayURL      string
	CreatedAt    time.Time
	ExpiresAt    time.Time
	PlayersCount int
	AwaitsInput  bool
}

Jump to

Keyboard shortcuts

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