Documentation
¶
Index ¶
- Constants
- func Del(c *gin.Context, key string) error
- func EnableCookieSession(req *CookieSessionReq) gin.HandlerFunc
- func EnableMemorySession(key string) gin.HandlerFunc
- func EnableRedisSession(req *RedisSessionReq) gin.HandlerFunc
- func Get(c *gin.Context, key string) interface{}
- func GetSessionId(c *gin.Context) (int64, error)
- func Set(c *gin.Context, key string, value interface{}) (err error)
- type CookieSessionReq
- type RedisSessionReq
- func (r *RedisSessionReq) SetAddress(address string) *RedisSessionReq
- func (r *RedisSessionReq) SetKey(key []byte) *RedisSessionReq
- func (r *RedisSessionReq) SetMaxAge(maxAge int) *RedisSessionReq
- func (r *RedisSessionReq) SetPassword(pwd string) *RedisSessionReq
- func (r *RedisSessionReq) SetPath(path string) *RedisSessionReq
- func (r *RedisSessionReq) SetSessionName(name string) *RedisSessionReq
- func (r *RedisSessionReq) SetSize(size int) *RedisSessionReq
Constants ¶
View Source
const (
NotFound = "session_not_found"
)
Variables ¶
This section is empty.
Functions ¶
func EnableCookieSession ¶
func EnableCookieSession(req *CookieSessionReq) gin.HandlerFunc
EnableCookieSession 使用 Cookie 保存 session
func EnableMemorySession ¶
func EnableMemorySession(key string) gin.HandlerFunc
EnableMemorySession 使用 内存 保存 session
func EnableRedisSession ¶
func EnableRedisSession(req *RedisSessionReq) gin.HandlerFunc
EnableRedisSession 使用 Redis 保存 session
Types ¶
type CookieSessionReq ¶
func NewCookieSessionReq ¶
func NewCookieSessionReq() *CookieSessionReq
func (*CookieSessionReq) SetKey ¶
func (c *CookieSessionReq) SetKey(key []byte) *CookieSessionReq
func (*CookieSessionReq) SetMaxAge ¶
func (c *CookieSessionReq) SetMaxAge(maxAge int) *CookieSessionReq
func (*CookieSessionReq) SetPath ¶
func (c *CookieSessionReq) SetPath(path string) *CookieSessionReq
func (*CookieSessionReq) SetSessionName ¶
func (c *CookieSessionReq) SetSessionName(name string) *CookieSessionReq
type RedisSessionReq ¶
type RedisSessionReq struct { Size int Address string Password string Key []byte Path string MaxAge int Name string }
func NewRedisSessionReq ¶
func NewRedisSessionReq() *RedisSessionReq
func (*RedisSessionReq) SetAddress ¶
func (r *RedisSessionReq) SetAddress(address string) *RedisSessionReq
func (*RedisSessionReq) SetKey ¶
func (r *RedisSessionReq) SetKey(key []byte) *RedisSessionReq
func (*RedisSessionReq) SetMaxAge ¶
func (r *RedisSessionReq) SetMaxAge(maxAge int) *RedisSessionReq
func (*RedisSessionReq) SetPassword ¶
func (r *RedisSessionReq) SetPassword(pwd string) *RedisSessionReq
func (*RedisSessionReq) SetPath ¶
func (r *RedisSessionReq) SetPath(path string) *RedisSessionReq
func (*RedisSessionReq) SetSessionName ¶
func (r *RedisSessionReq) SetSessionName(name string) *RedisSessionReq
func (*RedisSessionReq) SetSize ¶
func (r *RedisSessionReq) SetSize(size int) *RedisSessionReq
Click to show internal directories.
Click to hide internal directories.