package models import ( "time" ) // each session contains the username of the user and the time at which it expires type Session struct { ID uint32 `db:"id"` // CurrentRoom string // Expiry time.Time UpdatedAt time.Time `db:"updated_at"` Lifetime uint32 `db:"lifetime"` // minutes TokenKey string `db:"token_key"` Username string `db:"username"` // username is playerid } // we'll use this method later to determine if the session has expired func (s Session) IsExpired() bool { // return time.Now().After(s.UpdatedAt.Add(time.Minute * time.Duration(s.Lifetime))) return false } // func ListUsernames(ss map[string]*Session) []string { // resp := make([]string, 0, len(ss)) // for _, s := range ss { // resp = append(resp, s.Username) // } // return resp // }