Documentation ¶
Overview ¶
Package session provide a full-featured session component.
Index ¶
- func CheckChanged(s *Session) bool
- func ConfigMemory(maxAgeMinute, checkNum int, cookieKey string)
- func ConfigPermanent(maxAgeMinute, checkNum int, cookieKey string)
- func Log()
- func SetStorage(s Storage)
- func StorePermanentSession(s *Session)
- type DBSession
- type DBStorage
- type IdDecoder
- type Session
- func (s *Session) Del(key string)
- func (s *Session) DelData(key string)
- func (s *Session) Flash(key string) (value string)
- func (s *Session) FlashData(key string) (data interface{})
- func (s *Session) Get(key string) (value string)
- func (s *Session) GetData(key string) interface{}
- func (s *Session) Set(key, value string)
- func (s *Session) SetData(key string, data interface{})
- type SessionGC
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigMemory ¶
func ConfigPermanent ¶
func SetStorage ¶
func SetStorage(s Storage)
func StorePermanentSession ¶
func StorePermanentSession(s *Session)
Types ¶
type IdDecoder ¶
type IdDecoder struct {
// contains filtered or unexported fields
}
IdDecoder for generate UUID or read from cookie
func NewIdDecoder ¶
type Session ¶
type Session struct { Id string Values map[string]string // contains filtered or unexported fields }
func NewMemorySession ¶
func NewMemorySession(w http.ResponseWriter, r *http.Request) *Session
func NewPermanentSession ¶
func NewPermanentSession(w http.ResponseWriter, r *http.Request) *Session
type SessionGC ¶
type SessionGC struct {
// contains filtered or unexported fields
}
var MemoryGC *SessionGC
var PermanentGC *SessionGC
func NewSessionGC ¶
func NewSessionGC() *SessionGC
func (*SessionGC) SetStorage ¶
type Storage ¶
type Storage interface { // Destroy for deleting sessions and return destroyed ids Destroy(ids []string) (destroyed []string) // Read for reading the Session instance Read(id string) *Session // Write for updating session Write(s *Session) // GetAll for initializing GC time, it must return all of the stored ids GetAll() (ids []string) }
Storage for storing and recovering the session value
Click to show internal directories.
Click to hide internal directories.