Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSession ¶ added in v1.4.3
func InitSession(options *SessionOptions)
Types ¶
type CookieOptions ¶
type HttpCookie ¶
type HttpCookie struct {
// contains filtered or unexported fields
}
cookie 操作
func NewHttpCookie ¶
func NewHttpCookie(req *http.Request, writer http.ResponseWriter, options *CookieOptions) *HttpCookie
type HttpSession ¶
type HttpSession struct {
// contains filtered or unexported fields
}
func NewHttpSession ¶
func NewHttpSession(cookie *HttpCookie) *HttpSession
type SessionData ¶
type SessionData struct {
Key string `json:"key"` //session key
Value utils.M `json:"data"` //session value
Expire int `json:"expire"` //过期时间
}
session 数据
func (*SessionData) ParseJson ¶
func (m *SessionData) ParseJson(data []byte) error
func (*SessionData) ParseJsonString ¶
func (m *SessionData) ParseJsonString(data string) error
func (*SessionData) ToJson ¶
func (m *SessionData) ToJson() []byte
func (*SessionData) ToJsonString ¶
func (m *SessionData) ToJsonString() string
type SessionOptions ¶
type SessionOptions struct {
StorageType SessionType //Session 存储类型
SurvivalTime time.Duration //Session 存活时间
CookieName string //Session cookie name
}
session 选项
type SessionType ¶
type SessionType int
const ( SessionMem SessionType = iota SessionRedis SessionFile )
Click to show internal directories.
Click to hide internal directories.