docs: 排行榜 GetRank 函数增加注释,提示排名从 0 开始

This commit is contained in:
kercylan98 2023-07-05 14:26:10 +08:00
parent b5b428ddc1
commit 1001d50c04
2 changed files with 2 additions and 0 deletions

View File

@ -87,6 +87,7 @@ func (slf *RankingList[CompetitorID, Score]) Size() int {
}
// GetRank 获取竞争者排名
// - 排名从 0 开始
func (slf *RankingList[CompetitorID, Score]) GetRank(competitorId CompetitorID) (int, error) {
competitorScore, exist := slf.competitors.GetExist(competitorId)
if !exist {

View File

@ -12,6 +12,7 @@ type RankingList[CompetitorID comparable, Score generic.Ordered] interface {
// Size 获取竞争者数量
Size() int
// GetRank 获取竞争者排名
// - 排名从 0 开始
GetRank(competitorId CompetitorID) (int, error)
// GetCompetitor 获取特定排名的竞争者
GetCompetitor(rank int) (CompetitorID, error)