Documentation ¶
Overview ¶
Package sqlitestore implements sessionup.Store interface for SQLite database.
Index ¶
- Constants
- type SqliteStore
- func (store *SqliteStore) CleanupErr() <-chan error
- func (store *SqliteStore) Create(ctx context.Context, session sessionup.Session) error
- func (store *SqliteStore) DeleteByID(ctx context.Context, id string) error
- func (store *SqliteStore) DeleteByUserKey(ctx context.Context, key string, sessionIDsToKeep ...string) error
- func (store *SqliteStore) FetchByID(ctx context.Context, id string) (sessionup.Session, bool, error)
- func (store *SqliteStore) FetchByUserKey(ctx context.Context, key string) ([]sessionup.Session, error)
- func (store *SqliteStore) StopCleanup()
Constants ¶
const ( PART_SEPARATOR = ";" KEY_VALUE_SEPARATOR = ":" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SqliteStore ¶
type SqliteStore struct {
// contains filtered or unexported fields
}
SqliteStore is a SQLite implementation of sessionup.Store.
func New ¶
New returns a fresh instance of SqliteStore. tableName parameter determines the name of the table that will be used for sessions. If it does not exist, it will be created. Duration parameter determines how often the cleanup function wil be called to remove the expired sessions. Setting it to 0 will prevent cleanup from being activated.
func (*SqliteStore) CleanupErr ¶
func (store *SqliteStore) CleanupErr() <-chan error
CleanupErr returns a receive-only channel to get errors produced during the automatic cleanup. NOTE: channel must be drained in order for the cleanup process to be able to continue.
func (*SqliteStore) DeleteByID ¶
func (store *SqliteStore) DeleteByID(ctx context.Context, id string) error
DeleteByID implements sessionup.Store interface's DeleteByID method.
func (*SqliteStore) DeleteByUserKey ¶
func (store *SqliteStore) DeleteByUserKey(ctx context.Context, key string, sessionIDsToKeep ...string) error
DeleteByUserKey implements sessionup.Store interface's DeleteByUserKey method.
func (*SqliteStore) FetchByID ¶
func (store *SqliteStore) FetchByID(ctx context.Context, id string) (sessionup.Session, bool, error)
FetchByID implements sessionup.Store interface's FetchByID method.
func (*SqliteStore) FetchByUserKey ¶
func (store *SqliteStore) FetchByUserKey(ctx context.Context, key string) ([]sessionup.Session, error)
FetchByUserKey implements sessionup.Store interface's FetchByUserKey method.
func (*SqliteStore) StopCleanup ¶
func (store *SqliteStore) StopCleanup()
StopCleanup terminates the automatic cleanup process. Useful for testing and cases when store is used only temporarily. In order to restart the cleanup, a new store must be created.