sessions

package
v0.0.0-...-442dd3c Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Store map[string]*Session
}

Database object to store sessions in memory

func GetDB

func GetDB() *Database

GetDB returns database

func InitDB

func InitDB() *Database

InitDB initializes database

func (*Database) AddSession

func (db *Database) AddSession(token string, session *Session)

AddSession in store

type Session

type Session struct {
	Token     string    `json:"token"`
	Moves     [9]int    `json:"moves"`
	Board     [9]string `json:"board"`
	MoveCount int       `json:"moveCount"`
	Player1   *players.Player
	Player2   *players.Player
}

Session object

func Create

func Create(db *Database, mode string) *Session

Create makes a new Session entry in the db

func (*Session) Update

func (session *Session) Update(move int, symbol string)

Update updates session status

Jump to

Keyboard shortcuts

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