Documentation
¶
Index ¶
- Variables
- func DefaultInvalidSessionErrorHandler(err error, store gorillasessions.Store, name string, c echo.Context) error
- func Middleware(store gorillasessions.Store) echo.MiddlewareFunc
- func MiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc
- func NewCookieStore(secret []byte) *gorillasessions.CookieStore
- type InvalidSessionErrorHandlerFunc
- type MiddlewareConfig
- type Session
- func (s *Session) AddFlash(value any, vars ...string)
- func (s *Session) Clear()
- func (s *Session) Flashes(vars ...string) []any
- func (s *Session) Get(key string) any
- func (s *Session) GetBool(key string) bool
- func (s *Session) GetInt(key string) int
- func (s *Session) GetInt64(key string) int64
- func (s *Session) GetString(key string) string
- func (s *Session) Internal() *gorillasessions.Session
- func (s *Session) IsNew() bool
- func (s *Session) Options() *gorillasessions.Options
- func (s *Session) Save() error
- func (s *Session) Set(key string, value any)
- func (s *Session) Values() map[any]any
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSession = fmt.Errorf("no session in context")
Functions ¶
func Middleware ¶
func Middleware(store gorillasessions.Store) echo.MiddlewareFunc
func MiddlewareWithConfig ¶
func MiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc
func NewCookieStore ¶
func NewCookieStore(secret []byte) *gorillasessions.CookieStore
NewCookieStore creates a new CookieStore using the given secret key. It is a thin wrapper around gorilla/sessions.NewCookieStore with recommended options.
Types ¶
type MiddlewareConfig ¶
type MiddlewareConfig struct {
Skipper middleware.Skipper
// Store is the session store used to get and save sessions.
Store gorillasessions.Store
// Name is the name of the session cookie. The default is "session".
Name string
// InvalidSessionErrorHandler is called when an invalid session is detected.
InvalidSessionErrorHandler InvalidSessionErrorHandlerFunc
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func MustGet ¶
MustGet retrieves the session from the echo.Context and panics if it fails. If your handlers run after the session middleware, the session should always be available. This function is provided as a convenience to avoid error handling in such cases.
func (*Session) Internal ¶
func (s *Session) Internal() *gorillasessions.Session
func (*Session) Options ¶
func (s *Session) Options() *gorillasessions.Options
Click to show internal directories.
Click to hide internal directories.