Flash data middleware for tango
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lunny Xiao 2b17fd0aed
use go mod & add drone
6 months ago
.drone.yml use go mod & add drone 6 months ago
LICENSE license 4 years ago
README.md use go mod & add drone 6 months ago
circle.yml update CI config 2 years ago
flash.go migrate to gitea.com/lunny/tango 8 months ago
flash_test.go migrate to gitea.com/lunny/tango 8 months ago
go.mod use go mod & add drone 6 months ago
go.sum use go mod & add drone 6 months ago

README.md

flash Build Status

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.