Documentation ¶
Index ¶
- Constants
- func Codec() (*event.Codec, error)
- type Claims
- type Credentials
- type Deck
- type DeckID
- type DeckRepository
- type Game
- type Match
- type Participant
- type Phase
- type Player
- func (plr *Player) Apply(e event.Event)
- func (plr *Player) ChangeName(name string) error
- func (plr *Player) ChangeRole(role string) error
- func (plr *Player) Create(id PlayerID, tracker TrackerID, role string, mail string, password string) error
- func (plr *Player) MakeDetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
- func (plr *Player) MakeUndetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
- func (plr *Player) Mutate(e event.Event)
- func (plr *Player) RegisterTournament(tID TournamentID) error
- func (plr *Player) Save(es *event.Store, metadata interface{}) error
- type PlayerCreated
- type PlayerID
- type PlayerNameChanged
- type PlayerRepository
- type PlayerRoleChanged
- type PlayerTournamentRegistered
- type Projection
- type Seat
- type Server
- type Store
- func (s *Store) FindAllDecks() ([]Deck, error)
- func (s *Store) FindAllPlayers() ([]Player, error)
- func (s *Store) FindAllTournaments() ([]Tournament, error)
- func (s *Store) FindCredentialsByMail(mail string) (Credentials, PlayerID, error)
- func (s *Store) FindDeckByID(id DeckID) (Deck, error)
- func (s *Store) FindPlayerByID(id PlayerID) (Player, error)
- func (s *Store) FindTournamentByID(id TournamentID) (Tournament, error)
- func (s *Store) GetVersion() uint64
- func (s *Store) IsDeckNameAvailable(name string) (bool, error)
- func (s *Store) IsMailAvailable(mail string) (bool, error)
- func (s *Store) IsPlayerNameAvailable(name string) (bool, error)
- func (s *Store) IsTournamentNameAvailable(name string) (bool, error)
- func (s *Store) On(rec event.Record)
- func (s *Store) PlayerExists(ID PlayerID) (bool, error)
- type Tournament
- func (trn *Tournament) Apply(e event.Event)
- func (trn *Tournament) Begin() error
- func (trn *Tournament) ChangeFormat(f string) error
- func (trn *Tournament) ChangeGamesToWin(n int) error
- func (trn *Tournament) ChangeMaxPlayers(n int) error
- func (trn *Tournament) ChangeName(name string) error
- func (trn *Tournament) ChangePhase(p Phase) error
- func (trn *Tournament) Create(id TournamentID) error
- func (trn *Tournament) CreateMatches() error
- func (trn *Tournament) Delete() error
- func (trn *Tournament) DropPlayer(pID PlayerID) error
- func (trn *Tournament) EndGame(match int, game int, wnr PlayerID, draw bool) error
- func (trn *Tournament) EndMatch(match int, wnr PlayerID, draw bool) error
- func (trn *Tournament) Finish() error
- func (trn *Tournament) MakeDetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
- func (trn *Tournament) MakeMatches()
- func (trn *Tournament) MakeParticipantsHyperItem(resolve hyper.ResolverFunc) (hyper.Item, error)
- func (trn *Tournament) MakeUndetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
- func (trn *Tournament) Mutate(e event.Event)
- func (trn *Tournament) RegisterPlayer(pID PlayerID) error
- func (trn *Tournament) Save(es *event.Store, metadata interface{}) error
- type TournamentCreated
- type TournamentDeleted
- type TournamentEnded
- type TournamentFormatChanged
- type TournamentGameEnded
- type TournamentGamesToWinChanged
- type TournamentID
- type TournamentMatchEnded
- type TournamentMatchesCreated
- type TournamentMaxPlayersChanged
- type TournamentNameChanged
- type TournamentPhaseChanged
- type TournamentPlayerDropped
- type TournamentPlayerRegistered
- type TournamentRepository
- type TournamentStarted
- type Tracker
- func (trk *Tracker) Apply(e event.Event)
- func (trk *Tracker) Create(id TrackerID, plr PlayerID) error
- func (trk *Tracker) IncrementGames() error
- func (trk *Tracker) IncrementGamesWon() error
- func (trk *Tracker) IncrementMatches() error
- func (trk *Tracker) IncrementMatchesWon() error
- func (trk *Tracker) MakeTrackerHyperItem(resolve hyper.ResolverFunc) hyper.Item
- func (trk *Tracker) Mutate(e event.Event)
- func (trk *Tracker) Save(es *event.Store, metadata interface{}) error
- type TrackerCreated
- type TrackerGamePlayed
- type TrackerGameWon
- type TrackerID
- type TrackerMatchPlayed
- type TrackerMatchWon
Constants ¶
View Source
const ( PhaseRegistration = "registration" PhaseInitialization = "initialization" PhaseDraft = "draft" PhaseRounds = "rounds" PhaseEnded = "ended" )
View Source
const ( ActionChangeName = "change-name" ActionChangeRole = "change-role" )
View Source
const ( ActionDelete = "delete" ActionRegisterPlayer = "register-player" ActionDropPlayer = "drop-player" ActionCreate = "create" ActionChangeFormat = "change-format" ActionChangeMaxPlayers = "change-maxplayers" ActionEndPhase = "end-phase" ActionEndGame = "end-game" ActionChangeGamesToWin = "change-gamestowin" )
View Source
const ( ArgumentTournamentID = "tid" ArgumentPlayerID = "pid" ArgumentName = "name" ArgumentRole = "role" ArgumentFormat = "format" ArgumentMaxPlayers = "maxplayers" ArgumentMatch = "match" ArgumentGame = "game" ArgumentGamesToWin = "gamestowin" ArgumentDraw = "draw" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Credentials ¶
type Deck ¶
func (*Deck) MakeDetailedHyperItem ¶
func (dck *Deck) MakeDetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
func (*Deck) MakeUndetailedHyperItem ¶
func (dck *Deck) MakeUndetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
type DeckRepository ¶
type Participant ¶
type Player ¶
type Player struct { ID PlayerID `json:"id,omitempty"` Role string `json:"role"` Version uint64 `json:"version"` Name string `json:"name"` Tournaments []TournamentID `json:"tournaments"` Tracker TrackerID `json:"tracker"` Mail string `json:"mail"` Password string `json:"password"` *event.ChangeRecorder Server *Server }
func (*Player) ChangeName ¶
func (*Player) ChangeRole ¶
func (*Player) MakeDetailedHyperItem ¶
func (plr *Player) MakeDetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
func (*Player) MakeUndetailedHyperItem ¶
func (plr *Player) MakeUndetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
func (*Player) RegisterTournament ¶
func (plr *Player) RegisterTournament(tID TournamentID) error
type PlayerCreated ¶
type PlayerNameChanged ¶
type PlayerRepository ¶
type PlayerRepository interface { FindAllPlayers() ([]Player, error) FindPlayerByID(id PlayerID) (Player, error) IsPlayerNameAvailable(name string) (bool, error) PlayerExists(id PlayerID) (bool, error) IsMailAvailable(mail string) (bool, error) FindCredentialsByMail(mail string) (Credentials, PlayerID, error) }
type PlayerRoleChanged ¶
type PlayerTournamentRegistered ¶
type PlayerTournamentRegistered struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Player PlayerID `json:"player"` Tournament TournamentID `json:"Tournament"` }
type Projection ¶
type Projection interface { TournamentRepository PlayerRepository DeckRepository On(rec event.Record) GetVersion() uint64 }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) HandleGETTracker ¶
func (s *Server) HandleGETTracker(w http.ResponseWriter, r *http.Request)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) FindAllDecks ¶
func (*Store) FindAllPlayers ¶
func (*Store) FindAllTournaments ¶
func (s *Store) FindAllTournaments() ([]Tournament, error)
func (*Store) FindCredentialsByMail ¶
func (s *Store) FindCredentialsByMail(mail string) (Credentials, PlayerID, error)
func (*Store) FindTournamentByID ¶
func (s *Store) FindTournamentByID(id TournamentID) (Tournament, error)
func (*Store) GetVersion ¶
func (*Store) IsPlayerNameAvailable ¶
func (*Store) IsTournamentNameAvailable ¶
type Tournament ¶
type Tournament struct { ID TournamentID `json:"id"` Version uint64 `json:"version"` Name string `json:"name"` Phase Phase `json:"phase"` Start string `json:"start,omitempty"` End string `json:"end,omitempty"` Format string `json:"format,omitempty"` MaxPlayers int `json:"maxplayers,omitempty"` Seats []Seat `json:"seats"` Matches []Match `json:"matches"` GamesToWin int `json:"gamesToWin"` Participants []Participant `json:"players,omitempty"` Deleted bool `json:"deleted"` *event.ChangeRecorder Server *Server }
func LoadTournament ¶
func LoadTournament(s *Server, tID TournamentID) (*Tournament, error)
func NewTournament ¶
func NewTournament(s *Server) *Tournament
func (*Tournament) Apply ¶
func (trn *Tournament) Apply(e event.Event)
func (*Tournament) Begin ¶
func (trn *Tournament) Begin() error
func (*Tournament) ChangeFormat ¶
func (trn *Tournament) ChangeFormat(f string) error
func (*Tournament) ChangeGamesToWin ¶
func (trn *Tournament) ChangeGamesToWin(n int) error
func (*Tournament) ChangeMaxPlayers ¶
func (trn *Tournament) ChangeMaxPlayers(n int) error
func (*Tournament) ChangeName ¶
func (trn *Tournament) ChangeName(name string) error
func (*Tournament) ChangePhase ¶
func (trn *Tournament) ChangePhase(p Phase) error
func (*Tournament) Create ¶
func (trn *Tournament) Create(id TournamentID) error
func (*Tournament) CreateMatches ¶
func (trn *Tournament) CreateMatches() error
func (*Tournament) Delete ¶
func (trn *Tournament) Delete() error
func (*Tournament) DropPlayer ¶
func (trn *Tournament) DropPlayer(pID PlayerID) error
func (*Tournament) EndMatch ¶
func (trn *Tournament) EndMatch(match int, wnr PlayerID, draw bool) error
func (*Tournament) Finish ¶
func (trn *Tournament) Finish() error
func (*Tournament) MakeDetailedHyperItem ¶
func (trn *Tournament) MakeDetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
func (*Tournament) MakeMatches ¶
func (trn *Tournament) MakeMatches()
func (*Tournament) MakeParticipantsHyperItem ¶
func (trn *Tournament) MakeParticipantsHyperItem(resolve hyper.ResolverFunc) (hyper.Item, error)
func (*Tournament) MakeUndetailedHyperItem ¶
func (trn *Tournament) MakeUndetailedHyperItem(resolve hyper.ResolverFunc) hyper.Item
func (*Tournament) Mutate ¶
func (trn *Tournament) Mutate(e event.Event)
func (*Tournament) RegisterPlayer ¶
func (trn *Tournament) RegisterPlayer(pID PlayerID) error
type TournamentCreated ¶
type TournamentCreated struct { ID string `json:"id"` OccurredOn time.Time `json:"occured-on"` Tournament TournamentID `json:"tournament"` }
type TournamentDeleted ¶
type TournamentDeleted struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` }
type TournamentEnded ¶
type TournamentFormatChanged ¶
type TournamentFormatChanged struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` Format string `json:"format"` }
type TournamentGameEnded ¶
type TournamentGamesToWinChanged ¶
type TournamentGamesToWinChanged struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` GamesToWin int `json:"gamesToWin"` }
type TournamentID ¶
type TournamentID string
type TournamentMatchEnded ¶
type TournamentMatchesCreated ¶
type TournamentMatchesCreated struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` }
type TournamentMaxPlayersChanged ¶
type TournamentMaxPlayersChanged struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` MaxPlayers int `json:"maxplayers"` }
type TournamentNameChanged ¶
type TournamentNameChanged struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` Name string `json:"name"` }
type TournamentPhaseChanged ¶
type TournamentPhaseChanged struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` Phase Phase `json:"phase"` }
type TournamentPlayerDropped ¶
type TournamentPlayerDropped struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` Player PlayerID `json:"player"` }
type TournamentPlayerRegistered ¶
type TournamentPlayerRegistered struct { ID string `json:"id"` OccurredOn time.Time `json:"occurred-on"` Tournament TournamentID `json:"tournament"` Player PlayerID `json:"player"` }
type TournamentRepository ¶
type TournamentRepository interface { FindAllTournaments() ([]Tournament, error) FindTournamentByID(id TournamentID) (Tournament, error) IsTournamentNameAvailable(name string) (bool, error) }
type TournamentStarted ¶
type Tracker ¶
type Tracker struct { ID TrackerID `json:"id"` Player PlayerID `json:"player"` Version uint64 `json:"version"` Matches int `json:"matches"` MatchWins int `json:"matchWins"` Games int `json:"games"` GameWins int `json:"gameWins"` *event.ChangeRecorder }
func NewTracker ¶
func NewTracker() *Tracker
func (*Tracker) IncrementGames ¶
func (*Tracker) IncrementGamesWon ¶
func (*Tracker) IncrementMatches ¶
func (*Tracker) IncrementMatchesWon ¶
func (*Tracker) MakeTrackerHyperItem ¶
func (trk *Tracker) MakeTrackerHyperItem(resolve hyper.ResolverFunc) hyper.Item
type TrackerCreated ¶
type TrackerGamePlayed ¶
type TrackerGameWon ¶
type TrackerMatchPlayed ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.