sessions

package
v0.0.0-...-688727d Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	ID         string    `json:"id"`
	UserID     uint64    `json:"user_id"`
	CreateDate time.Time `json:"create_date"`
}

Session is a user's session

type SessionHandler

type SessionHandler struct {
	// contains filtered or unexported fields
}

SessionHandler receives session-related functions, embedding the session database connection pool

func GetSessionHandler

func GetSessionHandler() *SessionHandler

GetSessionHandler returns the initialize instance of the SessionHandler

func (*SessionHandler) GetUserID

func (sess *SessionHandler) GetUserID(r *http.Request) uint64

GetUserID attempts to retrieve a User's ID form the Request's Session. Returns 0 if not found.

func (*SessionHandler) NewSession

func (sess *SessionHandler) NewSession(w http.ResponseWriter, userID uint64) *Session

NewSession creates and stores a session cookie (sid)

Jump to

Keyboard shortcuts

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