Documentation ¶
Index ¶
- Variables
- type Finder
- type Handle
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) FindHandleSeesion(fd Finder, hd Handle) []*Session
- func (m *Manager) FindSeesion(fds ...Finder) []*Session
- func (m *Manager) Load(r *http.Request) (*Session, error)
- func (m *Manager) LoadIM(r *http.Request) (*Session, error)
- func (m *Manager) NewSession() (*Session, error)
- func (m *Manager) Option(opts ...Option)
- func (m *Manager) RunGC()
- func (m *Manager) Stat()
- func (m *Manager) Use(next http.Handler) http.Handler
- func (m *Manager) Write(session *Session, w http.ResponseWriter) error
- type Option
- type Options
- type Session
- func (s *Session) Clear() error
- func (s *Session) Destroy() error
- func (s *Session) Exists(key string) (bool, error)
- func (s *Session) Get(key string) (interface{}, bool, error)
- func (s *Session) GetBool(key string) (bool, error)
- func (s *Session) GetBytes(key string) ([]byte, error)
- func (s *Session) GetData() map[string]interface{}
- func (s *Session) GetExpiry() time.Time
- func (s *Session) GetFloat64(key string) (float64, error)
- func (s *Session) GetID() string
- func (s *Session) GetInt(key string) (int, error)
- func (s *Session) GetInt64(key string) (int64, error)
- func (s *Session) GetObject(key string, dst interface{}) error
- func (s *Session) GetString(key string) (string, error)
- func (s *Session) GetTime(key string) (time.Time, error)
- func (s *Session) GetToken() string
- func (s *Session) Keys() ([]string, error)
- func (s *Session) LastAccessTime() time.Time
- func (s *Session) MayTouch() bool
- func (s *Session) Pop(key string) (interface{}, bool, error)
- func (s *Session) PopBool(key string) (bool, error)
- func (s *Session) PopBoolFromResponseWriter(w http.ResponseWriter, key string) (bool, error)
- func (s *Session) PopBytes(key string) ([]byte, error)
- func (s *Session) PopBytesFromResponseWriter(w http.ResponseWriter, key string) ([]byte, error)
- func (s *Session) PopFloat64(key string) (float64, error)
- func (s *Session) PopFloat64FromResponseWriter(w http.ResponseWriter, key string) (float64, error)
- func (s *Session) PopFromResponseWriter(w http.ResponseWriter, key string) (interface{}, bool, error)
- func (s *Session) PopInt(key string) (int, error)
- func (s *Session) PopInt64(key string) (int64, error)
- func (s *Session) PopInt64FromResponseWriter(w http.ResponseWriter, key string) (int64, error)
- func (s *Session) PopIntFromResponseWriter(w http.ResponseWriter, key string) (int, error)
- func (s *Session) PopObject(key string, dst interface{}) error
- func (s *Session) PopObjectFromResponseWriter(w http.ResponseWriter, key string, dst interface{}) error
- func (s *Session) PopString(key string) (string, error)
- func (s *Session) PopStringFromResponseWriter(w http.ResponseWriter, key string) (string, error)
- func (s *Session) PopTime(key string) (time.Time, error)
- func (s *Session) PopTimeFromResponseWriter(w http.ResponseWriter, key string) (time.Time, error)
- func (s *Session) Put(key string, val interface{}) error
- func (s *Session) PutBool(key string, val bool) error
- func (s *Session) PutBoolToResponseWriter(w http.ResponseWriter, key string, val bool) error
- func (s *Session) PutBytes(key string, val []byte) error
- func (s *Session) PutBytesToResponseWriter(w http.ResponseWriter, key string, val []byte) error
- func (s *Session) PutFloat64(key string, val float64) error
- func (s *Session) PutFloat64ToResponseWriter(w http.ResponseWriter, key string, val float64) error
- func (s *Session) PutInt(key string, val int) error
- func (s *Session) PutInt64(key string, val int64) error
- func (s *Session) PutInt64ToResponseWriter(w http.ResponseWriter, key string, val int64) error
- func (s *Session) PutIntToResponseWriter(w http.ResponseWriter, key string, val int) error
- func (s *Session) PutObject(key string, val interface{}) error
- func (s *Session) PutObjectToResponseWriter(w http.ResponseWriter, key string, val interface{}) error
- func (s *Session) PutString(key string, val string) error
- func (s *Session) PutStringToResponseWriter(w http.ResponseWriter, key string, val string) error
- func (s *Session) PutTime(key string, val time.Time) error
- func (s *Session) PutTimeToResponseWriter(w http.ResponseWriter, key string, val time.Time) error
- func (s *Session) PutToResponseWriter(w http.ResponseWriter, key string, val interface{}) error
- func (s *Session) Remove(key string) error
- func (s *Session) TimeOut() bool
- func (s *Session) Write(bs []byte) error
- func (s *Session) WriteToResponseWriter(w http.ResponseWriter) error
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrTypeAssertionFailed = errors.New("type assertion failed")
ErrTypeAssertionFailed 断言错误
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager session控制器
func NewCookieManager ¶
NewCookieManager 返回cookie-session管理器 客户端存储
func NewManager ¶
NewManager 返回session管理器 并且伴随生成一个gc任务
func (*Manager) FindHandleSeesion ¶
FindHandleSeesion 查找并处理session
func (*Manager) FindSeesion ¶
FindSeesion 查找session
func (*Manager) NewSession ¶
NewSession 创建并且返回一个Session
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options 大部分继承自http Cookie里字段
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session 一个会话状态
func (*Session) GetFloat64 ¶
GetFloat64 获取
func (*Session) PopBoolFromResponseWriter ¶
PopBoolFromResponseWriter 移除并返回
func (*Session) PopBytesFromResponseWriter ¶
PopBytesFromResponseWriter 移除并返回
func (*Session) PopFloat64 ¶
PopFloat64 移除并返回
func (*Session) PopFloat64FromResponseWriter ¶
PopFloat64FromResponseWriter 移除并返回
func (*Session) PopFromResponseWriter ¶
func (s *Session) PopFromResponseWriter(w http.ResponseWriter, key string) (interface{}, bool, error)
PopFromResponseWriter 移除并返回
func (*Session) PopInt64FromResponseWriter ¶
PopInt64FromResponseWriter 移除并返回
func (*Session) PopIntFromResponseWriter ¶
PopIntFromResponseWriter 移除并返回
func (*Session) PopObjectFromResponseWriter ¶
func (s *Session) PopObjectFromResponseWriter(w http.ResponseWriter, key string, dst interface{}) error
PopObject 移除并返回
func (*Session) PopStringFromResponseWriter ¶
PopStringFromResponseWriter 移除并返回
func (*Session) PopTimeFromResponseWriter ¶
PopTimeFromResponseWriter 移除并返回
func (*Session) PutBoolToResponseWriter ¶
PutBoolToResponseWriter 存储
func (*Session) PutBytesToResponseWriter ¶
PutBytesToResponseWriter 存储
func (*Session) PutFloat64 ¶
PutFloat64 存入,存在则替换
func (*Session) PutFloat64ToResponseWriter ¶
PutFloat64ToResponseWriter 存储
func (*Session) PutInt64ToResponseWriter ¶
PutInt64ToResponseWriter 存储
func (*Session) PutIntToResponseWriter ¶
PutIntToResponseWriter 存储
func (*Session) PutObjectToResponseWriter ¶
func (s *Session) PutObjectToResponseWriter(w http.ResponseWriter, key string, val interface{}) error
PutObject 存入,存在则替换
func (*Session) PutStringToResponseWriter ¶
PutStringToResponseWriter 存储string
func (*Session) PutTimeToResponseWriter ¶
PutTimeToResponseWriter 存储
func (*Session) PutToResponseWriter ¶
func (s *Session) PutToResponseWriter(w http.ResponseWriter, key string, val interface{}) error
PutToResponseWriter 存入,存在则替换
func (*Session) WriteToResponseWriter ¶
func (s *Session) WriteToResponseWriter(w http.ResponseWriter) error
WriteToResponseWriter 将session数据写入到返回中
type Store ¶
type Store interface { // 存储session,如果token一致,则更新session,同时改写过期时间 Save(token string, b []byte, expiry time.Time) (err error) // 移除给定token的session并且获取,如果不存在,返回nil Delete(token string) (err error) // 查找给定token的session Find(token string) (b []byte, found bool, err error) // session数据落地,与Loads主要是针对memoryStore Dumps() (err error) // 加载保存的session数据 Loads() (bs [][]byte, err error) }
Store 存储session 存储的实际是Session的data和deadline
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
example
|
|
stores
|
|
boltstore
Package boltstore is a boltdb based session store for the SCS session package.
|
Package boltstore is a boltdb based session store for the SCS session package. |
buntstore
Package buntstore is a buntdb based session store for the SCS session package.
|
Package buntstore is a buntdb based session store for the SCS session package. |
dynamostore
Package dynamostore is a DynamoDB-based session store for the SCS session package.
|
Package dynamostore is a DynamoDB-based session store for the SCS session package. |
memstore
Package memstore is a in-memory session store for the SCS session package.
|
Package memstore is a in-memory session store for the SCS session package. |
mysqlstore
Package mysqlstore is a MySQL-based session store for the SCS session package.
|
Package mysqlstore is a MySQL-based session store for the SCS session package. |
pgstore
Package pgstore is a PostgreSQL-based session store for the SCS session package.
|
Package pgstore is a PostgreSQL-based session store for the SCS session package. |
qlstore
Package qlstore is a ql-based session store for the SCS session package.
|
Package qlstore is a ql-based session store for the SCS session package. |
redisstore
Package redisstore is a Redis-based session store for the SCS session package.
|
Package redisstore is a Redis-based session store for the SCS session package. |