Documentation ¶
Index ¶
- type BetDetail
- type BetSummary
- type RedisRepo
- func (repo *RedisRepo) AddNewBet(betID int, startDate string) error
- func (repo *RedisRepo) BetIDExists(betID int) (bool, error)
- func (repo *RedisRepo) GetBetDetails(betID int) ([]BetDetail, error)
- func (repo *RedisRepo) GetBetSummary(betID int) (*BetSummary, error)
- func (repo *RedisRepo) GetIDOfOpenBet() (int, error)
- func (repo *RedisRepo) GetLastBetID() (int, error)
- func (repo *RedisRepo) GetWinnerScore(betID int) (int, error)
- func (repo *RedisRepo) SetBetAsEnded(betID int, date string) error
- func (repo *RedisRepo) SetBetDetail(betID int, details []BetDetail) error
- func (repo *RedisRepo) SetBetWinner(betID int, winner int) error
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BetSummary ¶
func (*BetSummary) String ¶
func (b *BetSummary) String() string
type RedisRepo ¶
type RedisRepo struct {
Url string
}
func (*RedisRepo) AddNewBet ¶
AddNewBet adds a new bet info with given id and startDate. returns error in case of a connection error.
func (*RedisRepo) BetIDExists ¶
BetIDExists returns true if a bet with given id exists returns error for any connection error
func (*RedisRepo) GetBetDetails ¶
GetBetDetails finds and returns details list of the bet. returns error in case of a connection error.
func (*RedisRepo) GetBetSummary ¶
func (repo *RedisRepo) GetBetSummary(betID int) (*BetSummary, error)
GetBetSummary returns summary of bet with ID return error for any connection error
func (*RedisRepo) GetIDOfOpenBet ¶
GetIDOfOpenBet returns the id of the open bet if there is any. in redis, openBet is indicated by `OpenBet` identifier. returns error in case of a connection error.
func (*RedisRepo) GetLastBetID ¶
GetLastBetID returns the last inserted bet id into the system returns error in case of a connection error.
func (*RedisRepo) GetWinnerScore ¶
GetWinnerScore returns the winner score that belongs to the bet with betID. Returns -1 if bet doesn't have a winnerScore. returns error in case of a connection error.
func (*RedisRepo) SetBetAsEnded ¶
SetBetAsEnded marks the bet as ended and sets the endDate with given date. returns error in case of a connection error.
func (*RedisRepo) SetBetDetail ¶
type Repo ¶
type Repo interface { AddNewBet(int, string) error BetIDExists(betID int) (bool, error) GetBetDetails(int) ([]BetDetail, error) GetIDOfOpenBet() (int, error) GetLastBetID() (int, error) GetWinnerScore(int) (int, error) SetBetAsEnded(int, string) error SetBetDetail(int, []BetDetail) error SetBetWinner(int, int) error GetBetSummary(betID int) (*BetSummary, error) }