Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidId = errors.New("mgostore: invalid session id")
Functions ¶
This section is empty.
Types ¶
type CookieToken ¶
type CookieToken struct{}
func (*CookieToken) SetToken ¶
func (*CookieToken) SetToken(rw http.ResponseWriter, name, value string, options *sessions.Options, )
type MongoStore ¶
type MongoStore struct { Codecs []securecookie.Codec Options *sessions.Options Token TokenGetSeter // contains filtered or unexported fields }
MongoStore stores sessions in MongoDB
func NewMongoStore ¶
func NewMongoStore(c *mongo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte, ) *MongoStore
NewMongoStore returns a new MongoStore. Set ensureTTL to true let the database auto-remove expired object by maxAge.
func (*MongoStore) Get ¶
Get registers and returns a session for the given name and session store. It returns a new session if there are no sessions registered for the name.
func (*MongoStore) MaxAge ¶
func (m *MongoStore) MaxAge(age int)
MaxAge sets the maximum age for the store and the underlying cookie implementation. Individual sessions can be deleted by setting Options.MaxAge = -1 for that session.
func (*MongoStore) New ¶
New returns a session for the given name without adding it to the registry.
func (*MongoStore) Save ¶
func (m *MongoStore) Save(_ *http.Request, w http.ResponseWriter, session *sessions.Session, ) error
Save saves all sessions registered for the current request.
Click to show internal directories.
Click to hide internal directories.