server

package
v0.0.0-...-2896ce9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoUserPresentError = errors.New("no user present")
View Source
var UserExistsError = errors.New("user exists")

Functions

This section is empty.

Types

type ConfigurationType

type ConfigurationType struct {
	Server   string
	Storage  string
	RedisUri string
	MongoUri string
	Message  string
}

type LeaderboardServer

type LeaderboardServer struct {
	http.Handler
	// contains filtered or unexported fields
}

func NewLeaderboardServer

func NewLeaderboardServer(store LeaderboardStore, isDevelopment bool) *LeaderboardServer

type LeaderboardStore

type LeaderboardStore interface {
	GetUserRankings() []User
	GetUserRankingsFiltered(country string) []User
	CreateUserProfile(user User) (User, error)
	GetUserProfile(userId string) (User, error)
	SubmitUserScore(score Score) (Score, error)
	CreateUserProfiles(submission Submission) error
	CreateScoreSubmissions(submission Submission) error
}

type Score

type Score struct {
	Score     float64 `json:"score"`
	UserId    string  `json:"user_id"`
	TimeStamp string  `json:"time_stamp"`
}

type Submission

type Submission struct {
	SubmissionSize int `json:"submission_size"`
	MaxScore       int `json:"max_score"`
	MinScore       int `json:"min_score"`
}

type User

type User struct {
	UserId             string  `json:"user_id,omitempty" bson:"_id"`
	DisplayName        string  `json:"display_name" bson:"display_name"`
	Points             float64 `json:"points" bson:"points"`
	Rank               int64   `json:"rank" bson:"rank"`
	Country            string  `json:"country" bson:"country"`
	LastScoreTimeStamp string  `bson:"last_score_timestamp"`
}

func (User) MarshalBinary

func (u User) MarshalBinary() ([]byte, error)

Jump to

Keyboard shortcuts

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