Documentation ¶
Index ¶
- type Option
- type SimpleSession
- func (ss *SimpleSession) Del(key string)
- func (ss *SimpleSession) Destroy(res http.ResponseWriter) error
- func (ss *SimpleSession) FilePath() string
- func (ss *SimpleSession) Get(key string) interface{}
- func (ss *SimpleSession) Id() string
- func (ss *SimpleSession) Name() string
- func (ss *SimpleSession) Set(key string, val interface{})
- func (ss *SimpleSession) Write() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct { Path string Domain string // MaxAge=0 means no 'Max-Age' attribute specified. // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'. // MaxAge>0 means Max-Age attribute present and given in seconds. MaxAge int Secure bool HttpOnly bool }
Option stores configuration for a session cookie.
Fields are a subset of http.Cookie fields.
type SimpleSession ¶
type SimpleSession struct {
// contains filtered or unexported fields
}
SimpleSession stores the session data and option configuration for a session.
func New ¶
func New(res http.ResponseWriter, option *Option) (*SimpleSession, error)
New is called to create a new session instance
func Read ¶
func Read(req *http.Request) (*SimpleSession, error)
Read reads stored session from session file
func (*SimpleSession) Del ¶
func (ss *SimpleSession) Del(key string)
Del deletes the session data by key-value pair
func (*SimpleSession) Destroy ¶
func (ss *SimpleSession) Destroy(res http.ResponseWriter) error
Destroy completely destroys the session including data stored on session file
func (*SimpleSession) FilePath ¶
func (ss *SimpleSession) FilePath() string
FilePath gives the session directory where we store the session file
func (*SimpleSession) Get ¶
func (ss *SimpleSession) Get(key string) interface{}
Get retrieves the value by given key from local session variable
func (*SimpleSession) Id ¶
func (ss *SimpleSession) Id() string
Id returns the session id currently in use
func (*SimpleSession) Name ¶
func (ss *SimpleSession) Name() string
Name returns the name of the registered session
func (*SimpleSession) Set ¶
func (ss *SimpleSession) Set(key string, val interface{})
Set stores the value by given key to local session variable
func (*SimpleSession) Write ¶
func (ss *SimpleSession) Write() error
Write flush the locally stored data onto session file