Documentation ¶
Overview ¶
Package sessions provides a cookie based session manager. It's heavily based on gorilla session but with a structured session payload that can be serialized to json.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlashMessage ¶
FlashMessage is a message stored in the session.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the session handler with its global options.
func NewHandler ¶
NewHandler creates a session handler.
type Payload ¶
type Payload struct { Seed int `json:"s"` User int `json:"u"` Flashes []FlashMessage `json:"f"` }
Payload contains session values.
type Session ¶
type Session struct { Payload *Payload IsNew bool MaxAge int // contains filtered or unexported fields }
Session is a unique session.
func (*Session) Flashes ¶
func (s *Session) Flashes() []FlashMessage
Flashes retrieves the flash messages from the session and flushes them. The session is not saved, it's up to the code (middleware) that calls this function to save the session.
Click to show internal directories.
Click to hide internal directories.