service

package
v0.0.0-...-4b884ea Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidChoice = errors.New("invalid choice")
)

Functions

func GenerateSessionID

func GenerateSessionID() string

func RandomMove

func RandomMove() model.Choice

Types

type Session

type Session interface {
	StartSession(ctx context.Context, playerId string) (*model.Session, error)
	GetSession(ctx context.Context, sessionId string) (*model.Session, error)
	DeleteSession(ctx context.Context, sessionId string) (*model.Session, error)
	Move(ctx context.Context, move model.Move) (*model.Session, model.Choice, error)
}

func NewSessionService

func NewSessionService(ctx context.Context,
	l *zap.Logger,
	generateSessionId func() string,
	computerMove func() model.Choice,
	sessionRepo repository.Session) Session

Jump to

Keyboard shortcuts

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