Documentation
¶
Overview ¶
Package ggsession will hold various useful data for Sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Store *sessions.CookieStore
Store is the session store.
Functions ¶
func GetSession ¶
GetSession returns the session with the open cookie file.
func MustBeAdmin ¶
func MustBeAdmin(handler http.HandlerFunc) http.HandlerFunc
func MustBeAuthenticated ¶
func MustBeAuthenticated(handler http.HandlerFunc) http.HandlerFunc
Types ¶
type BasePageData ¶
BasePageData is the data that most pages will need. This can be used to build the data struct for templates.
func (*BasePageData) BasicData ¶
func (data *BasePageData) BasicData(session SessionData)
BasicData fills in the BasePageData struct from the provided session.
type Flash ¶
Flash will be used to add flash messages to the session cookie. Class indicates the type of message, and will be used for CSS purposes. Message is the message itself.
Classes should be of the following values:
error: An Error messages success: Success that warents notification. info: Useful information that might not be overly important. Warning: Warning the user that they should procede carefuly.
type SessionData ¶
SessionData is a the struct to move data between the session cookie and the program.
func GetSessionData ¶
func GetSessionData(session *sessions.Session) SessionData
GetSessionData grabs the SessionData struct from the cookie and returns it.
func NewSessionData ¶
func NewSessionData() SessionData
NewSessionData returns a default SessionData struct.
func (*SessionData) AddFlash ¶
func (sessionData *SessionData) AddFlash(class string, message string)
AddFlash adds a flash message to the SessionData object
func (*SessionData) GetFlashes ¶
func (sessionData *SessionData) GetFlashes(clearData bool) []Flash
GetFlashes will add the flash messages from the SessionData struct t the PageData struct.