Documentation ¶
Index ¶
- type Game
- type GamesStatistics
- type Handler
- func (h *Handler) GetAllGames(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetGame(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetGamesByPlayer(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetGamesStatistics(w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Register(router *http.ServeMux)
- type Service
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct { ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"` PointsGained int `json:"points_gained,omitempty" bson:"points_gained,omitempty"` WinStatus int8 `json:"win_status,omitempty" bson:"win_status,omitempty"` GameType int8 `json:"game_type,omitempty" bson:"game_type,omitempty"` Created time.Time `json:"created,omitempty" bson:"created,omitempty"` UserID primitive.ObjectID `json:"user_id,omitempty" bson:"user_id,omitempty"` }
type GamesStatistics ¶
type GamesStatistics struct { GroupByDay []struct { GroupDate string `json:"date" bson:"date"` GamesPlayed int64 `json:"games_played" bson:"games_played"` } `json:"group_by_day" bson:"group_by_day"` WithGameType []struct { GameDate string `json:"date" bson:"date"` GameType int8 `json:"game_type" bson:"game_type"` GamesPlayed int64 `json:"games_played" bson:"games_played"` } `json:"with_game_type" bson:"with_game_type"` }
type Handler ¶
func (*Handler) GetAllGames ¶
func (*Handler) GetGamesByPlayer ¶
func (*Handler) GetGamesStatistics ¶
type Service ¶
type Service interface { GetById(ctx context.Context, id string) (Game, error) GetByPlayer(ctx context.Context, uuid string, limit, page int64) ([]Game, error) GetAll(ctx context.Context, limit, page int64) ([]Game, error) GetGamesStatistics(ctx context.Context, userId string, startDate, endDate time.Time) ([]GamesStatistics, error) }
type Storage ¶
type Storage interface { FindById(ctx context.Context, id string) (Game, error) FindByPlayer(ctx context.Context, uuid string, limit, page int64) ([]Game, error) FindAll(ctx context.Context, limit, page int64) ([]Game, error) AggregateGamesStatistics(ctx context.Context, uuid string, startDate, endDate time.Time) ([]GamesStatistics, error) }
Click to show internal directories.
Click to hide internal directories.