session

package
v0.0.0-...-a00ab96 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFound = "session_not_found"
)

Variables

This section is empty.

Functions

func Del

func Del(c *gin.Context, key string) error

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

func Get

func Get(c *gin.Context, key string) interface{}

func GetSessionId

func GetSessionId(c *gin.Context) (int64, error)

func Set

func Set(c *gin.Context, key string, value interface{}) (err error)

Types

type CookieSessionReq

type CookieSessionReq struct {
	Key    []byte
	Path   string
	MaxAge int
	Name   string
}

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

Jump to

Keyboard shortcuts

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