Documentation ¶
Index ¶
- Variables
- func Render(input string, std *os.File)
- func RunCLI(p Tracker)
- type Battle
- type BattleCode
- type Habit
- type HabitID
- type LocalTracker
- func (t *LocalTracker) DisplayHabits(username Username) []string
- func (t *LocalTracker) GetBattleAssociations(username Username, habitID HabitID) []BattleCode
- func (t *LocalTracker) JoinBattle(code BattleCode, username Username, habitID HabitID) error
- func (t *LocalTracker) PerformHabit(username Username, habitID HabitID) (int, error)
- func (t *LocalTracker) RegisterBattle(username Username, habitID HabitID) (BattleCode, error)
- type RPCClient
- func (c *RPCClient) DisplayHabits(username Username) []string
- func (c *RPCClient) GetBattleAssociations(username Username, habitID HabitID) []BattleCode
- func (c *RPCClient) JoinBattle(code BattleCode, username Username, habitID HabitID) error
- func (c *RPCClient) PerformHabit(username Username, habitID HabitID) (int, error)
- func (c *RPCClient) RegisterBattle(username Username, habitID HabitID) (BattleCode, error)
- type Server
- func (s *Server) Client() *RPCClient
- func (s *Server) DisplayHabits(ctx context.Context, req *habitpb.ListHabitsRequest) (*habitpb.ListHabitsResponse, error)
- func (s *Server) GetBattleAssociations(ctx context.Context, req *habitpb.BattleAssociationsRequest) (*habitpb.BattleAssociationsResponse, error)
- func (s *Server) JoinBattle(ctx context.Context, req *habitpb.BattleRequest) (*habitpb.BattleResponse, error)
- func (s *Server) PerformHabit(ctx context.Context, req *habitpb.PerformHabitRequest) (*habitpb.PerformHabitResponse, error)
- func (s *Server) RegisterBattle(ctx context.Context, req *habitpb.BattleRequest) (*habitpb.BattleResponse, error)
- type Store
- type TimeOption
- type Tracker
- type Username
Constants ¶
This section is empty.
Variables ¶
View Source
var BattleCodeGenerator = generateBattleCode
View Source
var Now = time.Now
Functions ¶
Types ¶
type Battle ¶
type Battle struct { HabitOne *Habit HabitTwo *Habit Code BattleCode Winner string }
func CreateChallenge ¶
func (*Battle) DetermineWinner ¶
type BattleCode ¶
type BattleCode string
type LocalTracker ¶
type LocalTracker struct {
Store Store
}
func NewTracker ¶
func NewTracker(s Store) *LocalTracker
func (*LocalTracker) DisplayHabits ¶
func (t *LocalTracker) DisplayHabits(username Username) []string
func (*LocalTracker) GetBattleAssociations ¶
func (t *LocalTracker) GetBattleAssociations(username Username, habitID HabitID) []BattleCode
func (*LocalTracker) JoinBattle ¶
func (t *LocalTracker) JoinBattle(code BattleCode, username Username, habitID HabitID) error
func (*LocalTracker) PerformHabit ¶
func (t *LocalTracker) PerformHabit(username Username, habitID HabitID) (int, error)
func (*LocalTracker) RegisterBattle ¶
func (t *LocalTracker) RegisterBattle(username Username, habitID HabitID) (BattleCode, error)
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func NewRPCClient ¶
func (*RPCClient) DisplayHabits ¶
func (*RPCClient) GetBattleAssociations ¶
func (c *RPCClient) GetBattleAssociations(username Username, habitID HabitID) []BattleCode
func (*RPCClient) JoinBattle ¶
func (c *RPCClient) JoinBattle(code BattleCode, username Username, habitID HabitID) error
func (*RPCClient) PerformHabit ¶
func (*RPCClient) RegisterBattle ¶
func (c *RPCClient) RegisterBattle(username Username, habitID HabitID) (BattleCode, error)
type Server ¶
type Server struct { habitpb.UnimplementedHabitServiceServer Tracker // contains filtered or unexported fields }
func (*Server) DisplayHabits ¶
func (s *Server) DisplayHabits(ctx context.Context, req *habitpb.ListHabitsRequest) (*habitpb.ListHabitsResponse, error)
func (*Server) GetBattleAssociations ¶
func (s *Server) GetBattleAssociations(ctx context.Context, req *habitpb.BattleAssociationsRequest) (*habitpb.BattleAssociationsResponse, error)
func (*Server) JoinBattle ¶
func (s *Server) JoinBattle(ctx context.Context, req *habitpb.BattleRequest) (*habitpb.BattleResponse, error)
func (*Server) PerformHabit ¶
func (s *Server) PerformHabit(ctx context.Context, req *habitpb.PerformHabitRequest) (*habitpb.PerformHabitResponse, error)
func (*Server) RegisterBattle ¶
func (s *Server) RegisterBattle(ctx context.Context, req *habitpb.BattleRequest) (*habitpb.BattleResponse, error)
type TimeOption ¶
Click to show internal directories.
Click to hide internal directories.