Documentation
¶
Index ¶
- Variables
- func Destroy(ctx *gin.Context) error
- func FromContext(ctx *gin.Context) session.Store
- func New(opt ...session.Option) gin.HandlerFunc
- func NewWithConfig(config Config, opt ...session.Option) gin.HandlerFunc
- func Refresh(ctx *gin.Context) (session.Store, error)
- type Config
- type ErrorHandleFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultConfig is the default Recover middleware config. DefaultConfig = Config{ ErrorHandleFunc: func(ctx *gin.Context, err error) { _ = ctx.AbortWithError(500, err) }, StoreKey: "github.com/go-session/gin-session/store", ManageKey: "github.com/go-session/gin-session/manage", Skipper: func(_ *gin.Context) bool { return false }, } )
Functions ¶
func FromContext ¶
FromContext Get session storage from context
func NewWithConfig ¶
func NewWithConfig(config Config, opt ...session.Option) gin.HandlerFunc
NewWithConfig create a session middleware
Types ¶
type Config ¶
type Config struct { // error handling when starting the session ErrorHandleFunc ErrorHandleFunc // keys stored in the context StoreKey string // keys stored in the context ManageKey string // defines a function to skip middleware.Returning true skips processing // the middleware. Skipper func(*gin.Context) bool }
Config defines the config for Session middleware
type ErrorHandleFunc ¶
ErrorHandleFunc error handling function
Click to show internal directories.
Click to hide internal directories.