gorilla

package
v0.0.0-...-cba97e4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gorilla

type Gorilla struct {
	SessionName string
	Store       sessions.Store
}

Gorilla session manager struct for gorilla

func New

func New(sessionName string, store sessions.Store) *Gorilla

New initialize session manager for gorilla

func (Gorilla) Add

func (gorilla Gorilla) Add(w http.ResponseWriter, req *http.Request, key string, value interface{}) error

Add value to session data, if value is not string, will marshal it into JSON encoding and save it into session data.

func (Gorilla) Flash

func (gorilla Gorilla) Flash(w http.ResponseWriter, req *http.Request, message session.Message) error

Flash add flash message to session data

func (Gorilla) Flashes

func (gorilla Gorilla) Flashes(w http.ResponseWriter, req *http.Request) []session.Message

Flashes returns a slice of flash messages from session data

func (Gorilla) Get

func (gorilla Gorilla) Get(req *http.Request, key string) string

Get value from session data

func (Gorilla) Load

func (gorilla Gorilla) Load(req *http.Request, key string, result interface{}) error

Load get value from session data and unmarshal it into result

func (Gorilla) Middleware

func (gorilla Gorilla) Middleware(handler http.Handler) http.Handler

Middleware returns a new session manager middleware instance

func (Gorilla) Pop

func (gorilla Gorilla) Pop(w http.ResponseWriter, req *http.Request, key string) string

Pop value from session data

func (Gorilla) PopLoad

func (gorilla Gorilla) PopLoad(w http.ResponseWriter, req *http.Request, key string, result interface{}) error

PopLoad pop value from session data and unmarshal it into result

Jump to

Keyboard shortcuts

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