Documentation
¶
Index ¶
- func New() func(gas.DatabaseProvider, gas.Logger, gas.MigrationManager) *Store
- type Session
- type Store
- func (s *Store) DeleteExpiredSessions(ctx context.Context, before time.Time) (int64, error)
- func (s *Store) DeleteSession(ctx context.Context, id string) error
- func (s *Store) DeleteSessionsBySubject(ctx context.Context, subject string) error
- func (s *Store) ExtendSession(ctx context.Context, id string, expiresAt, lastActive time.Time) error
- func (s *Store) GetSession(ctx context.Context, id string) (*Session, error)
- func (s *Store) Init(serviceName string) error
- func (s *Store) InsertSession(ctx context.Context, sess *Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New() func(gas.DatabaseProvider, gas.Logger, gas.MigrationManager) *Store
New returns a DI-injectable constructor for Store.
Types ¶
type Session ¶
type Session struct {
CreatedAt time.Time
ExpiresAt time.Time
LastActive time.Time
Metadata gas.BasePrincipalMetadata
ID string
Subject string
IPAddress string
UserAgent string
}
Session represents a stored session record.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a database-backed session store. It delegates to sqlc-generated queries and selects the correct dialect adapter at init time.
func (*Store) DeleteExpiredSessions ¶
DeleteExpiredSessions deletes sessions that expired before the given time.
func (*Store) DeleteSession ¶
DeleteSession deletes a session by ID.
func (*Store) DeleteSessionsBySubject ¶
DeleteSessionsBySubject deletes all sessions for a subject.
func (*Store) ExtendSession ¶
func (s *Store) ExtendSession(ctx context.Context, id string, expiresAt, lastActive time.Time) error
ExtendSession updates the expiry and last active time.
func (*Store) GetSession ¶
GetSession retrieves a session by ID.
Click to show internal directories.
Click to hide internal directories.