Documentation ¶
Index ¶
- type MySQLStore
- func (m *MySQLStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})
- func (m *MySQLStore) Close()
- func (m *MySQLStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (m *MySQLStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (m *MySQLStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (m *MySQLStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (m *MySQLStore) StopCleanup(quit chan<- struct{}, done <-chan struct{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLStore ¶
type MySQLStore struct { Codecs []securecookie.Codec Options *sessions.Options // contains filtered or unexported fields }
MySQLStore stores the connection details for a session.
func NewMySQLStore ¶
func NewMySQLStore(endpoint string, tableName string, path string, maxAge int, keyPairs ...[]byte) (*MySQLStore, error)
NewMySQLStore creates a new MySQLStore from a MySQL DSN.
func NewMySQLStoreFromConnection ¶
func NewMySQLStoreFromConnection(db *sql.DB, tableName string, path string, maxAge int, keyPairs ...[]byte) (*MySQLStore, error)
NewMySQLStoreFromConnection creates a new MySQLStore from an existing MySQL database connection.
func (*MySQLStore) Cleanup ¶
func (m *MySQLStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})
Cleanup runs a background goroutine every interval that deletes expired sessions from the database.
The design is based on https://github.com/yosssi/boltstore
func (*MySQLStore) Delete ¶
func (m *MySQLStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Delete deletes a session.
func (*MySQLStore) Save ¶
func (m *MySQLStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save saves the session.
func (*MySQLStore) StopCleanup ¶
func (m *MySQLStore) StopCleanup(quit chan<- struct{}, done <-chan struct{})
StopCleanup stops the background cleanup from running.
Click to show internal directories.
Click to hide internal directories.