Documentation
¶
Index ¶
- Variables
- type Config
- type FileStore
- func (s *FileStore) Create(id string, ses *Session) (err error)
- func (s *FileStore) Delete(id string) (err error)
- func (s *FileStore) Expire(exp time.Duration) (err error)
- func (s *FileStore) Read(id string) (ses *Session, err error)
- func (s *FileStore) Update(id string, run func(*Session)) (err error)
- type Manager
- func (m *Manager) Delete(r *http.Request, key string) error
- func (m *Manager) Get(r *http.Request, key string) (interface{}, error)
- func (m *Manager) Remove(w http.ResponseWriter, r *http.Request) error
- func (m *Manager) Set(r *http.Request, key string, val string) error
- func (m *Manager) Token(r *http.Request, token *string) (string, error)
- func (m *Manager) Use(next http.Handler) http.Handler
- type MemoryStore
- type Session
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSessionNilContext - request session context is nil ErrSessionNilContext = errors.New("request session context is nil") // ErrSessionKeyInvalid - session data key does not exist or invalid ErrSessionKeyInvalid = errors.New("session data key does not exist or invalid") // ErrSessionNoRecord - session record does not exist or invalid ErrSessionNoRecord = errors.New("session record does not exist or invalid") )
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore struct
func NewFileStore ¶
NewFileStore creates a new file store Takes directory path for the database files Empty directory string defaults to "session"
func (*FileStore) Create ¶
Create adds a new session entry to the store Takes a session ID and Session struct or nil Pass nil to create default session Psss Session pointer to create an entry with pre defined data or overwrite existing
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager type
func (*Manager) Remove ¶
Remove deletes existing session record. Generates new session ID Takes HTTP request and response
type MemoryStore ¶
MemoryStore struct
func (*MemoryStore) Create ¶
func (s *MemoryStore) Create(id string, ses *Session) error
Create adds a new session entry to the store Takes a session ID and Session struct or nil Pass nil to create default session Psss Session pointer to create an entry with pre defined data or overwrite existing
func (*MemoryStore) Delete ¶
func (s *MemoryStore) Delete(id string) error
Delete removes Session from the store Takes session ID
func (*MemoryStore) Expire ¶
func (s *MemoryStore) Expire(exp time.Duration) (err error)
Expire removes expired records Takes expiration duration