Documentation ¶
Index ¶
Constants ¶
const ( // FlashSuccess is the context key for success flash messages FlashSuccess = "FlashSuccess" // FlashWarn is a context key for warning flash messages FlashWarn = "FlashWarn" // FlashErr is a context key for flash error message FlashErr = "FlashError" )
Variables ¶
This section is empty.
Functions ¶
func AddFlashToCtx ¶
AddFlashToCtx takes flash messages stored in a cookie which is associated with the request found in ctx, and puts them inside the ctx object. The flash messages can then be retrieved by calling ctx.Get( FlashKey).
NOTE When there are no flash messages then nothing is set.
Types ¶
type Flasher ¶
type Flasher struct {
// contains filtered or unexported fields
}
Flasher tracks flash messages
func New ¶
func New() *Flasher
New creates new flasher. This alllows accumulation of lash messages. To save the flash messages the Save method should be called explicitly.
type Flashes ¶
type Flashes []*Flash
Flashes is a collection of flash messages
func GetFlashes ¶
GetFlashes retieves all flash messages found in a cookie session associated with ctx..
name is the session name which is used to store the flash messages. The flash messages can be stored in any session, but it is a good idea to separate session for flash messages from other sessions.
key is the key that is used to identiry which flash messages are of interest.