docs: 排行榜 GetRank 函数增加注释,提示排名从 0 开始
This commit is contained in:
parent
b5b428ddc1
commit
1001d50c04
|
@ -87,6 +87,7 @@ func (slf *RankingList[CompetitorID, Score]) Size() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRank 获取竞争者排名
|
// GetRank 获取竞争者排名
|
||||||
|
// - 排名从 0 开始
|
||||||
func (slf *RankingList[CompetitorID, Score]) GetRank(competitorId CompetitorID) (int, error) {
|
func (slf *RankingList[CompetitorID, Score]) GetRank(competitorId CompetitorID) (int, error) {
|
||||||
competitorScore, exist := slf.competitors.GetExist(competitorId)
|
competitorScore, exist := slf.competitors.GetExist(competitorId)
|
||||||
if !exist {
|
if !exist {
|
||||||
|
|
|
@ -12,6 +12,7 @@ type RankingList[CompetitorID comparable, Score generic.Ordered] interface {
|
||||||
// Size 获取竞争者数量
|
// Size 获取竞争者数量
|
||||||
Size() int
|
Size() int
|
||||||
// GetRank 获取竞争者排名
|
// GetRank 获取竞争者排名
|
||||||
|
// - 排名从 0 开始
|
||||||
GetRank(competitorId CompetitorID) (int, error)
|
GetRank(competitorId CompetitorID) (int, error)
|
||||||
// GetCompetitor 获取特定排名的竞争者
|
// GetCompetitor 获取特定排名的竞争者
|
||||||
GetCompetitor(rank int) (CompetitorID, error)
|
GetCompetitor(rank int) (CompetitorID, error)
|
||||||
|
|
Loading…
Reference in New Issue