flash/README.md
Lunny Xiao e2b58d7cec
All checks were successful
checks / check and test (push) Successful in 32s
Use actions instead of drone
2023-04-20 15:51:08 +08:00

841 B

Flash

Middleware flash is a tool for share data between requests for Tango.

Notice

This is a new version, it stores all data via session not cookie. And it is slightly non-compitable with old version.

Installation

go get gitea.com/tango/flash

Simple Example


import "gitea.com/tango/session"

type FlashAction struct {
    flash.Flash
}

func (x *FlashAction) Get() {
    x.Flash.Set("test", "test")
}

func (x *FlashAction) Post() {
   x.Flash.Get("test").(string) == "test"
}

func main() {
    t := tango.Classic()
    sessions := session.Sessions()
    t.Use(flash.Flashes(sessions))
    t.Any("/", new(FlashAction))
    t.Run()
}

License

This project is under BSD License. See the LICENSE file for the full license text.