dbstore

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBStore

type DBStore struct {
	// contains filtered or unexported fields
}

func NewDBStore

func NewDBStore(db *sqlx.DB) DBStore

func (DBStore) Close

func (s DBStore) Close() error

func (DBStore) CreateSession

func (s DBStore) CreateSession(accountID string, sessionKey string, expirationDuration time.Duration) error

CreateSession creates a new session. It errors if a valid session already exists.

func (DBStore) DeleteSession

func (s DBStore) DeleteSession(sessionKey string) error

DeleteSession removes a session record from the db

func (DBStore) ExtendAndFetchSession

func (s DBStore) ExtendAndFetchSession(sessionKey string, expirationDuration time.Duration) (domain.Session, error)

ExtendAndFetchSession fetches session data from the db On success it returns the session On failure, it can return ErrValidSessionNotFound, ErrSessionExpired, or an unexpected error

func (DBStore) FetchPossiblyExpiredSession

func (s DBStore) FetchPossiblyExpiredSession(accountID string) (domain.Session, error)

FetchPossiblyExpiredSession returns a session row by account ID regardless of wether it is expired This is potentially dangerous, it is only intended to be used during the new login flow, never to check on a valid session for authentication purposes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL