Documentation ¶
Index ¶
- type PgStore
- func (p *PgStore) CleanupErr() <-chan error
- func (p *PgStore) Create(ctx context.Context, s sessionup.Session) error
- func (p *PgStore) DeleteByID(ctx context.Context, id string) error
- func (p *PgStore) DeleteByUserKey(ctx context.Context, key string, expID ...string) error
- func (p *PgStore) FetchByID(ctx context.Context, id string) (sessionup.Session, bool, error)
- func (p *PgStore) FetchByUserKey(ctx context.Context, key string) ([]sessionup.Session, error)
- func (p *PgStore) StopCleanup()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PgStore ¶
type PgStore struct {
// contains filtered or unexported fields
}
PgStore is a PostgreSQL implementation of sessionup.Store.
func New ¶
New returns a fresh instance of PgStore. tName 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 (*PgStore) CleanupErr ¶
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 (*PgStore) DeleteByID ¶
DeleteByID implements sessionup.Store interface's DeleteByID method.
func (*PgStore) DeleteByUserKey ¶
DeleteByUserKey implements sessionup.Store interface's DeleteByUserKey method.
func (*PgStore) FetchByUserKey ¶
FetchByUserKey implements sessionup.Store interface's FetchByUserKey method.
func (*PgStore) StopCleanup ¶
func (p *PgStore) StopCleanup()
StopCleanup terminates the automatic cleanup process. Useful for testing and cases when store is used only temporary. In order to restart the cleanup, new store must be created.