leaderboard

package
v0.0.0-...-27c6416 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package leaderboard starts a Gopher Run leaderboard server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddScore

func AddScore(ctx context.Context, client *firestore.Client, d ScoreData) (string, error)

AddScore adds a score to the leaderboard database and returns information about whether it updated an existing score.

Types

type ScoreData

type ScoreData struct {
	Name     string  `json:"name"`
	Team     string  `json:"team"`
	Coins    int     `json:"coins"`
	Distance float32 `json:"distance"`
	Combo    float32 `json:"combo"`
}

ScoreData is a player's score.

func TopScores

func TopScores(ctx context.Context, client *firestore.Client) ([]ScoreData, error)

TopScores returns the top 10 scores in the leaderboard.

Jump to

Keyboard shortcuts

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