Documentation
¶
Overview ¶
Package session SESSION 管理
Index ¶
- func ErrSessionIDNotExists() error
- func SecurityScheme[T any](s *Session[T], id string, desc web.LocaleStringer) *openapi.SecurityScheme
- type Session
- func (s *Session[T]) Delete(sessionid string) error
- func (s *Session[T]) GetInfo(ctx *web.Context) (T, bool)
- func (s *Session[T]) GetSessionID(ctx *web.Context) (string, error)
- func (s *Session[T]) Logout(ctx *web.Context) error
- func (s *Session[T]) Middleware(next web.HandlerFunc, _, _, _ string) web.HandlerFunc
- func (s *Session[T]) Save(ctx *web.Context, val T) error
- func (s *Session[T]) SecurityScheme(id string, desc web.LocaleStringer) *openapi.SecurityScheme
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrSessionIDNotExists ¶
func ErrSessionIDNotExists() error
func SecurityScheme ¶
func SecurityScheme[T any](s *Session[T], id string, desc web.LocaleStringer) *openapi.SecurityScheme
SecurityScheme 声明支持 openapi 的 openapi.SecurityScheme 对象
Types ¶
type Session ¶
type Session[T any] struct { // contains filtered or unexported fields }
Session session 管理
func New ¶
func New[T any](s web.Server, store Store[T], lifetime int, name, path, domain string, secure, httpOnly bool) *Session[T]
New 声明 Session 中间件
lifetime 为 session 的有效时间,单位为秒;其它参数为 cookie 的相关设置。
func (*Session[T]) GetSessionID ¶
func (*Session[T]) Middleware ¶
func (s *Session[T]) Middleware(next web.HandlerFunc, _, _, _ string) web.HandlerFunc
func (*Session[T]) SecurityScheme ¶
func (s *Session[T]) SecurityScheme(id string, desc web.LocaleStringer) *openapi.SecurityScheme
Click to show internal directories.
Click to hide internal directories.