Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSessionManager ¶
func NewSessionManager(store Store, options string) restgo.HTTPHandler
router.Use("/", NewSessionManager(newCookieStore(cookieStoreConfig), sessionManagerConfig)) name: name for session id in cookie, default sid
Types ¶
type CookieStore ¶
type CookieStore struct{}
func NewCookieSessionStore ¶
func NewCookieSessionStore() *CookieStore
func (*CookieStore) Destroy ¶
func (this *CookieStore) Destroy(sid interface{}) error
Destroy session by id
func (*CookieStore) Get ¶
func (this *CookieStore) Get(sid interface{}) (*Session, error)
for cookie store, sid will be session value
func (*CookieStore) Save ¶
func (this *CookieStore) Save(session *Session) (interface{}, error)
Save Session, do nothing, return sessions as sid
type Session ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
type Store ¶
type Store interface { Init(options string) error // give options to store, so that store can connect to db, or store options Get(sid interface{}) (*Session, error) Save(session *Session) (interface{}, error) // save session to store, update expire date, nothing need to do for cookie session Destroy(sid interface{}) error StoreName() string }
Click to show internal directories.
Click to hide internal directories.