learn-go-with-tests: github.com/quii/learn-go-with-tests/command-line/v1 Index | Files

package poker

import "github.com/quii/learn-go-with-tests/command-line/v1"


Package Files

file_system_store.go league.go server.go tape.go

type FileSystemPlayerStore Uses

type FileSystemPlayerStore struct {
    // contains filtered or unexported fields

FileSystemPlayerStore stores players in the filesystem.

func NewFileSystemPlayerStore Uses

func NewFileSystemPlayerStore(file *os.File) (*FileSystemPlayerStore, error)

NewFileSystemPlayerStore creates a FileSystemPlayerStore initialising the store if needed.

func (*FileSystemPlayerStore) GetLeague Uses

func (f *FileSystemPlayerStore) GetLeague() League

GetLeague returns the scores of all the players.

func (*FileSystemPlayerStore) GetPlayerScore Uses

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

GetPlayerScore retrieves a player's score.

func (*FileSystemPlayerStore) RecordWin Uses

func (f *FileSystemPlayerStore) RecordWin(name string)

RecordWin will store a win for a player, incrementing wins if already known.

type League Uses

type League []Player

League stores a collection of players.

func NewLeague Uses

func NewLeague(rdr io.Reader) (League, error)

NewLeague creates a league from JSON.

func (League) Find Uses

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

Find tries to return a player from a league.

type Player Uses

type Player struct {
    Name string
    Wins int

Player stores a name with a number of wins.

type PlayerServer Uses

type PlayerServer struct {
    // contains filtered or unexported fields

PlayerServer is a HTTP interface for player information.

func NewPlayerServer Uses

func NewPlayerServer(store PlayerStore) *PlayerServer

NewPlayerServer creates a PlayerServer with routing configured.

type PlayerStore Uses

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

PlayerStore stores score information about players.

Package poker imports 6 packages (graph). Updated 2020-06-19. Refresh now. Tools for package owners.