flash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStoreMissing = errors.New("flash store missing")

ErrStoreMissing indicates the flash store is not configured.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Message represents a flash message.

type Store

type Store struct {
	Store session.Store
	Key   string
}

Store persists flash messages in a session store.

func New

func New(store session.Store) Store

New creates a flash store with default key.

func (Store) Add

func (s Store) Add(w http.ResponseWriter, r *http.Request, msg Message) error

Add appends a flash message and saves the session.

func (Store) Peek

func (s Store) Peek(r *http.Request) ([]Message, error)

Peek returns flash messages without clearing them.

func (Store) Pop

func (s Store) Pop(w http.ResponseWriter, r *http.Request) ([]Message, error)

Pop returns flash messages and clears them from the session.

Jump to

Keyboard shortcuts

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