game

package
v0.0.0-...-1f9a799 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateScore

func CalculateScore(time int, errors int, text string) (int, int)

func CloseGameSession

func CloseGameSession(sessionId string)

func CreateSession

func CreateSession(online bool, language string) (entities.GameSession, error)

func DeleteOldSessionsForUser

func DeleteOldSessionsForUser(userId string)

func FindOpenSession

func FindOpenSession(online bool, language string) (entities.GameSession, bool)

Fetches the open session from database if exists

func GetPlayback

func GetPlayback(id string) (map[string]interface{}, bool)

func GetResultData

func GetResultData(id string) (entities.GameResult, bool)

func GetSession

func GetSession(sessionId string) (entities.GameSession, error)

func MarkSessionFinished

func MarkSessionFinished(sessionId string)

func OpenGameSession

func OpenGameSession(sessionId string)

func SaveGuestResult

func SaveGuestResult(identifier string, sessionId string, mistakes map[string]int, wpm int, accuracy int, gameTime int, place int, ip string, country string) (map[string]interface{}, bool)

Saves guest game results to the database. It'll be only used for internal purposes, such as stats

func SavePlayback

func SavePlayback(id string, playback []map[string]interface{})

func SaveResult

func SaveResult(user *entities.User, sessionId string, mistakes map[string]int, wpm int, accuracy int, gameTime int, place int, ip string) (entities.GameResult, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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