Documentation ¶
Overview ¶
Package httpssn defines the standard interfaces for HTTP sessions, which may be implemented as cookies, file-system based, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flashes ¶
type Flashes struct { // Store is the session store to use. Store Store // SessionName is the name of the session to use in the store. SessionName string // SessionKey is the key name under which to store flash messages in the // session. SessionKey string }
Flashes allows storing and retrieval of flash messages in a session store.
type MockSession ¶
type MockSession struct { NameFunc func() string IsNewFunc func() bool GetFunc func(string) interface{} SetFunc func(string, interface{}) UnsetFunc func(string) DeleteFunc func() }
MockSession is a test mock for the Session interface.
func (*MockSession) Delete ¶
func (m *MockSession) Delete()
func (*MockSession) Get ¶
func (m *MockSession) Get(key string) interface{}
func (*MockSession) IsNew ¶
func (m *MockSession) IsNew() bool
func (*MockSession) Name ¶
func (m *MockSession) Name() string
func (*MockSession) Set ¶
func (m *MockSession) Set(key string, v interface{})
func (*MockSession) Unset ¶
func (m *MockSession) Unset(key string)
type MockStore ¶
type MockStore struct { GetOrCreateFunc func(*http.Request, string) (Session, error) SaveFunc func(http.ResponseWriter, *http.Request, Session) error }
MockStore is a test mock for the Store interface.
func (*MockStore) GetOrCreate ¶
type Session ¶
type Session interface { // Name is the name of the session. Name() string // IsNew indicates if the session was created by the current request. IsNew() bool // Get returns the value associated with key in the session. Get(key string) interface{} // Set sets the value v for the key in the session. Set(key string, v interface{}) // Unset unsets the key in the session. Unset(key string) // Delete marks the session for deletion. Actual deletion is only // performed when the session is saved in its store. Delete() }
Session defines the methods to implement a Session managed by a Store.
type Store ¶
type Store interface { // GetOrCreate returns the session of the specified name for that request. If // no such session currently exists, it creates it. GetOrCreate(r *http.Request, name string) (Session, error) // Save saves the provided session for that request. Save(w http.ResponseWriter, r *http.Request, ssn Session) error }
Store defines the methods to implement an HTTP session store.
Click to show internal directories.
Click to hide internal directories.