Documentation
¶
Index ¶
- func Default(config Config)
- func Get(c router.Context) router.ViewContext
- func Redirect(c router.Context, location string, data any, status ...int) error
- func RedirectBack(c router.Context, fallback string, data router.ViewContext, status ...int) error
- func RedirectToRoute(c router.Context, routeName string, data router.ViewContext, status ...int) error
- func SetMessage(c router.Context, msg Message) router.Context
- func ToMiddleware(f *Flash, key string) router.MiddlewareFunc
- func WithData(c router.Context, data router.ViewContext) router.Context
- func WithError(c router.Context, data router.ViewContext) router.Context
- func WithInfo(c router.Context, data router.ViewContext) router.Context
- func WithSuccess(c router.Context, data router.ViewContext) router.Context
- func WithWarn(c router.Context, data router.ViewContext) router.Context
- type Config
- type Flash
- func (f *Flash) Get(c router.Context) router.ViewContext
- func (f *Flash) GetMessage(c router.Context) (*Message, bool)
- func (f *Flash) GetMessages(c router.Context) ([]Message, bool)
- func (f *Flash) Redirect(c router.Context, location string, data any, status ...int) error
- func (f *Flash) RedirectBack(c router.Context, fallback string, data router.ViewContext, status ...int) error
- func (f *Flash) RedirectToRoute(c router.Context, routeName string, data router.ViewContext, status ...int) error
- func (f *Flash) SetMessage(c router.Context, msg Message) router.Context
- func (f *Flash) WithData(c router.Context, data router.ViewContext) router.Context
- func (f *Flash) WithError(c router.Context, data router.ViewContext) router.Context
- func (f *Flash) WithInfo(c router.Context, data router.ViewContext) router.Context
- func (f *Flash) WithSuccess(c router.Context, data router.ViewContext) router.Context
- func (f *Flash) WithWarn(c router.Context, data router.ViewContext) router.Context
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedirectBack ¶
func RedirectToRoute ¶
func ToMiddleware ¶
func ToMiddleware(f *Flash, key string) router.MiddlewareFunc
func WithSuccess ¶
Types ¶
type Config ¶
type Config struct {
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
MaxAge int `json:"max_age"`
Expires time.Time `json:"expires"`
Secure bool `json:"secure"`
HTTPOnly bool `json:"http_only"`
SameSite string `json:"same_site"`
SessionOnly bool `json:"session_only"`
// ClientAccessible controls whether the flash cookie can be read by client-side JavaScript.
// Leave this false for SSR use-cases where middleware injects flash into templates.
// Set this true for purely client-rendered UIs that need to read the cookie after redirects.
ClientAccessible bool `json:"client_accessible"`
// DefaultMessageTitle and DefaultMessageText are used when setting toast messages with
// missing Title/Text fields.
DefaultMessageTitle string `json:"default_message_title"`
DefaultMessageText string `json:"default_message_text"`
}
type Flash ¶
type Flash struct {
// contains filtered or unexported fields
}
var DefaultFlash *Flash
func (*Flash) GetMessage ¶ added in v0.38.0
func (*Flash) GetMessages ¶ added in v0.38.0
func (*Flash) RedirectBack ¶
func (*Flash) RedirectToRoute ¶
func (*Flash) SetMessage ¶ added in v0.38.0
func (*Flash) WithSuccess ¶
type Message ¶ added in v0.38.0
func GetMessageFrom ¶ added in v0.38.0
func GetMessageFrom(data router.ViewContext) (*Message, bool)
func GetMessagesFrom ¶ added in v0.38.0
func GetMessagesFrom(data router.ViewContext) ([]Message, bool)
Click to show internal directories.
Click to hide internal directories.