leaderboard

package
v0.0.0-...-4a8b94e Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Leaderboard

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

func Get

func Get(name string) (*Leaderboard, int)

Get retrieves a leaderboard by name.

func New

func New(name string, maxEntries int, dupePushAbove bool, alwaysReplace bool) (*Leaderboard, int)

New creates a new leaderboard.

func (*Leaderboard) CheckAndPush

func (l *Leaderboard) CheckAndPush(name string, target float64, extra map[string]interface{}) bool

CheckAndPush checks the target against the leaderboard, and pushes worthy entries into it. Returns true if entry was pushed to leaderboard.

func (*Leaderboard) GetPage

func (l *Leaderboard) GetPage(limit int, page int) []LeaderboardEntry

GetPage gets a segment of the list for paging.

func (*Leaderboard) Len

func (l *Leaderboard) Len() int

Len returns the length of the leaderboard

func (*Leaderboard) Print

func (l *Leaderboard) Print()

Print prints the leaderboard to console.

type LeaderboardEntry

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

LeaderboardEntry is sorted in Leaderboard entries by the target.

Jump to

Keyboard shortcuts

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