poker

package
v0.0.0-...-cdffa6e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

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

func NewCLI

func NewCLI(store PlayerStore, in io.Reader) *CLI

func (*CLI) PlayPoker

func (cli *CLI) PlayPoker()

type FileSystemStore

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

func FileSystemPlayerStoreFromFile

func FileSystemPlayerStoreFromFile(path string) (*FileSystemStore, error)

func NewFileSystemStore

func NewFileSystemStore(database *os.File) (*FileSystemStore, error)

func (*FileSystemStore) GetLeague

func (f *FileSystemStore) GetLeague() League

func (*FileSystemStore) GetPlayerScore

func (f *FileSystemStore) GetPlayerScore(name string) int

func (*FileSystemStore) RecordWin

func (f *FileSystemStore) RecordWin(name string)

type InMemoryPlayerStore

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

func NewInMemoryPlayerStore

func NewInMemoryPlayerStore() *InMemoryPlayerStore

func (*InMemoryPlayerStore) GetLeague

func (i *InMemoryPlayerStore) GetLeague() League

func (*InMemoryPlayerStore) GetPlayerScore

func (i *InMemoryPlayerStore) GetPlayerScore(name string) int

func (*InMemoryPlayerStore) RecordWin

func (i *InMemoryPlayerStore) RecordWin(name string)

type League

type League []Player

func (League) Find

func (l League) Find(name string) *Player

type Player

type Player struct {
	Name string
	Wins int
}

func NewLeague

func NewLeague(rdr io.Reader) ([]Player, error)

type PlayerServer

type PlayerServer struct {
	http.Handler
	// contains filtered or unexported fields
}

func NewPlayerServer

func NewPlayerServer(store PlayerStore) *PlayerServer

func (*PlayerServer) GetPlayerScore

func (p *PlayerServer) GetPlayerScore(name string) int

type PlayerStore

type PlayerStore interface {
	GetPlayerScore(name string) int
	RecordWin(name string)
	GetLeague() League
}

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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