leaderboard

package
v0.0.0-...-d41363a Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JoinRequest

type JoinRequest struct {
	Name string `json:"name"`
}

type JoinResponse

type JoinResponse struct {
	Name  string `json:"name"`
	Score int64  `json:"score"`
}

type RoundResponse

type RoundResponse struct {
	LeftSymbol  string `json:"left_symbol"`
	RightSymbol string `json:"right_symbol"`
}

type RoundResultRequest

type RoundResultRequest struct {
	Name        string `json:"name"`
	LeftSymbol  string `json:"left_symbol"`
	RightSymbol string `json:"right_symbol"`
	ChooseLeft  bool   `json:"choose_left"`
}

type RoundResultResponse

type RoundResultResponse struct {
	IsWin        bool           `json:"is_win"`
	ChangedScore int64          `json:"changed_score"`
	Score        int64          `json:"score"`
	NextRound    *RoundResponse `json:"next_round"`
}

type ScoreItem

type ScoreItem struct {
	Name  string `json:"name"`
	Score int    `json:"score"`
}

type ScoreRankResponse

type ScoreRankResponse struct {
	Rank []ScoreItem `json:"rank"`
}

type Service

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

func NewService

func NewService(opt *config.ServiceOptions) *Service

func (*Service) Join

func (s *Service) Join(req *JoinRequest) (*JoinResponse, error)

func (*Service) Leaderboard

func (s *Service) Leaderboard() (*ScoreRankResponse, error)

func (*Service) NextRound

func (s *Service) NextRound() (*RoundResponse, error)

func (*Service) RoundResult

func (s *Service) RoundResult(req *RoundResultRequest) (*RoundResultResponse, error)

func (*Service) Serve

func (s *Service) Serve() error

Jump to

Keyboard shortcuts

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