Documentation
¶
Index ¶
- Constants
- func Load(cookieName string, ses *Session, req *http.Request) error
- func Save(cookieName string, ses *Session, res http.ResponseWriter) error
- type Serializable
- type Session
- func (session *Session) Add(obj Serializable)
- func (session *Session) FromBuffer(buffer []byte) error
- func (session *Session) GetBuffer() ([]byte, error)
- func (session *Session) GetIV() string
- func (session *Session) GetKey() string
- func (session *Session) GetSessionObjects() []Serializable
- func (session *Session) SetIV(iv string)
- func (session *Session) SetKey(key string)
Constants ¶
View Source
const (
//DefaultTTL is the default time to live for a session in seconds
DefaultTTL = 360
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Serializable ¶
type Serializable interface { //called to produce a string which will be stored in session cookie MarshalBinary() (data []byte, err error) //called to initialize object from a string stored in the session cookie UnmarshalBinary(data []byte) error //identifier used to identify this objects string in the session cookie GetIdentifier() string }
Serializable is an object that can be serialized in to the session cookie.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a session retrieved from an http request.
func NewSession ¶
NewSession constructs a new session with the given encryption key.
func (*Session) Add ¶
func (session *Session) Add(obj Serializable)
Add adds a serializable object to the session
func (*Session) FromBuffer ¶
FromBuffer builds the session object from a session object buffer
func (*Session) GetSessionObjects ¶
func (session *Session) GetSessionObjects() []Serializable
GetSessionObjects returns a list of all objects associated with the session
Click to show internal directories.
Click to hide internal directories.