sessions

package
v0.0.0-...-d3cc92b Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const FeedbackPkg = feedback.Package("sessions")

Variables

This section is empty.

Functions

func Clean

func Clean() error

Clean removes all sessions that no longer exist on the game server.

func ListGames

func ListGames() ([]string, error)

ListGames returns a list of all game URLs in the session store.

func ListSessions

func ListSessions() (map[string][]Session, error)

ListSessions returns a map of all game URLs in the session store mapped to a list of sessions.

Types

type Session

type Session struct {
	GameURL      string `json:"-"`
	PlayerID     string `json:"-"`
	Username     string `json:"username"`
	GameID       string `json:"game_id"`
	PlayerSecret string `json:"player_secret"`
}

func ListSessionsByGame

func ListSessionsByGame(gameURL string) ([]Session, error)

ListSessionsByGame returns a list of sessions for the game.

func LoadSession

func LoadSession(gameURL, playerID string) (Session, error)

Load a session from the session store.

func NewSession

func NewSession(gameURL, username, gameID, playerID, playerSecret string) Session

func (Session) Check

func (s Session) Check() (bool, error)

Check returns true if the player still exists in the game.

func (Session) Remove

func (s Session) Remove() error

Remove the session from the session store.

func (Session) Save

func (s Session) Save() error

Save the session to the session store.

Jump to

Keyboard shortcuts

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