Documentation ¶
Index ¶
- func InitRepositoryProvider(databaseProvider string)
- func NewPostgresSessionDataRepository(dcp *sql.DB) (interfaces.SessionDataStore, error)
- type SessionDataRepository
- func (m *SessionDataRepository) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})
- func (c *SessionDataRepository) DeleteValues(session, group string) error
- func (c *SessionDataRepository) GetValues(session, group string) (map[string]string, error)
- func (c *SessionDataRepository) IsValidSession(session int) (bool, error)
- func (c *SessionDataRepository) SetValues(session, group string, values map[string]string, autoExpire bool) error
- func (m *SessionDataRepository) StopCleanup(quit chan<- struct{}, done <-chan struct{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitRepositoryProvider ¶
func InitRepositoryProvider(databaseProvider string)
InitRepositoryProvider - One time init for the given DB Provider
func NewPostgresSessionDataRepository ¶
func NewPostgresSessionDataRepository(dcp *sql.DB) (interfaces.SessionDataStore, error)
NewPostgresSessionDataRepository will create a new instance of the SessionDataRepository
Types ¶
type SessionDataRepository ¶
type SessionDataRepository struct {
// contains filtered or unexported fields
}
SessionDataRepository is a RDB-backed Session Data repository
func (*SessionDataRepository) Cleanup ¶
func (m *SessionDataRepository) 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 (*SessionDataRepository) DeleteValues ¶
func (c *SessionDataRepository) DeleteValues(session, group string) error
DeleteValues deletes all values for the session and group
func (*SessionDataRepository) GetValues ¶
func (c *SessionDataRepository) GetValues(session, group string) (map[string]string, error)
GetValues returns all values from the config table as a map
func (*SessionDataRepository) IsValidSession ¶
func (c *SessionDataRepository) IsValidSession(session int) (bool, error)
IsValidSession - Determines if the given session ID is still valid (has not expired)
func (*SessionDataRepository) SetValues ¶
func (c *SessionDataRepository) SetValues(session, group string, values map[string]string, autoExpire bool) error
SetValues replaces existing group values with those provided
func (*SessionDataRepository) StopCleanup ¶
func (m *SessionDataRepository) StopCleanup(quit chan<- struct{}, done <-chan struct{})
StopCleanup stops the background cleanup from running.