Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type BaseCtxKey ¶
type BaseCtxKey string
type Context ¶
type ContextData ¶
type ContextData map[interface{}]interface{}
type FlashValues ¶
type FlashValues map[interface{}]interface{}
type Session ¶
type Session interface { Read(*http.Request, Context) error Write(http.ResponseWriter) error Name() string SetName(string) MaxAge() time.Duration SetMaxAge(time.Duration) CookieName() string SetCookieName(string) Set(interface{}, interface{}) Get(interface{}) (interface{}, bool) GetAll() SessionValues DeleteAll() Delete(interface{}) Flash(interface{}) (interface{}, bool) SetFlash(interface{}, interface{}) }
The Session represents persistent user data. Its Name field is how it is identified. The secret is used to salt the hmac, sent along the data to the client as a cookie. The data is a base64 encoded string, containing the session name and date showing when it was last used. The actual session data is stored in the filesystem, in a directory specified by the Path field. The data is serialized using encoding/gob, therefore any custom data type should be registered with it. The MaxAge field specifies a duration, after which an unused session will get cleared of its data and marked as expired. It is also used as the max-age and expires fields of the session cookie.
func NewSession ¶
NewSession creates a new session object.
type SessionGenerator ¶
type SessionValues ¶
type SessionValues map[interface{}]interface{}