Documentation
¶
Overview ¶
Package postgres implements the session storage driver for PostgreSQL.
Index ¶
- type Queryer
- type SessionStorageDriver
- func (s *SessionStorageDriver) ActivateUser(ctx context.Context, id ccc.UUID) error
- func (s *SessionStorageDriver) CreateUser(ctx context.Context, user *dbtype.InsertSessionUser) (*dbtype.SessionUser, error)
- func (s *SessionStorageDriver) DeactivateUser(ctx context.Context, id ccc.UUID) error
- func (s *SessionStorageDriver) DeleteUser(ctx context.Context, id ccc.UUID) error
- func (s *SessionStorageDriver) DestroyAllUserSessions(ctx context.Context, username string) error
- func (s *SessionStorageDriver) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (s *SessionStorageDriver) DestroySessionOIDC(ctx context.Context, oidcSID string) error
- func (s *SessionStorageDriver) InsertSession(ctx context.Context, insertSession *dbtype.InsertSession) (ccc.UUID, error)
- func (s *SessionStorageDriver) InsertSessionOIDC(ctx context.Context, insertSession *dbtype.InsertOIDCSession) (ccc.UUID, error)
- func (s *SessionStorageDriver) Session(ctx context.Context, sessionID ccc.UUID) (*dbtype.Session, error)
- func (s *SessionStorageDriver) SetSessionTableName(name string)
- func (s *SessionStorageDriver) SetUserPasswordHash(ctx context.Context, userID ccc.UUID, hash *securehash.Hash) error
- func (s *SessionStorageDriver) SetUserTableName(name string)
- func (s *SessionStorageDriver) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- func (s *SessionStorageDriver) User(ctx context.Context, id ccc.UUID) (*dbtype.SessionUser, error)
- func (s *SessionStorageDriver) UserByUserName(ctx context.Context, username string) (*dbtype.SessionUser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queryer ¶
type Queryer interface {
Begin(ctx context.Context) (pgx.Tx, error)
Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
}
Queryer is an interface that wraps the basic Query, QueryRow, and Exec methods.
type SessionStorageDriver ¶
type SessionStorageDriver struct {
// contains filtered or unexported fields
}
SessionStorageDriver represents the session storage implementation for PostgreSQL.
func NewSessionStorageDriver ¶
func NewSessionStorageDriver(conn Queryer) *SessionStorageDriver
NewSessionStorageDriver creates a new SessionStorageDriver
func (*SessionStorageDriver) ActivateUser ¶ added in v0.6.2
ActivateUser activates a user
func (*SessionStorageDriver) CreateUser ¶ added in v0.6.2
func (s *SessionStorageDriver) CreateUser(ctx context.Context, user *dbtype.InsertSessionUser) (*dbtype.SessionUser, error)
CreateUser creates a new user
func (*SessionStorageDriver) DeactivateUser ¶ added in v0.6.2
DeactivateUser deactivates a user
func (*SessionStorageDriver) DeleteUser ¶ added in v0.6.2
DeleteUser deletes a user
func (*SessionStorageDriver) DestroyAllUserSessions ¶ added in v0.6.2
func (s *SessionStorageDriver) DestroyAllUserSessions(ctx context.Context, username string) error
DestroyAllUserSessions destroys all sessions for a given user
func (*SessionStorageDriver) DestroySession ¶
DestroySession marks the session as expired
func (*SessionStorageDriver) DestroySessionOIDC ¶
func (s *SessionStorageDriver) DestroySessionOIDC(ctx context.Context, oidcSID string) error
DestroySessionOIDC marks the session as expired using the oidcSID
func (*SessionStorageDriver) InsertSession ¶
func (s *SessionStorageDriver) InsertSession(ctx context.Context, insertSession *dbtype.InsertSession) (ccc.UUID, error)
InsertSession inserts a Session into database
func (*SessionStorageDriver) InsertSessionOIDC ¶
func (s *SessionStorageDriver) InsertSessionOIDC(ctx context.Context, insertSession *dbtype.InsertOIDCSession) (ccc.UUID, error)
InsertSessionOIDC inserts a Session into database
func (*SessionStorageDriver) Session ¶
func (s *SessionStorageDriver) Session(ctx context.Context, sessionID ccc.UUID) (*dbtype.Session, error)
Session returns the session information from the database for given sessionID
func (*SessionStorageDriver) SetSessionTableName ¶ added in v0.6.1
func (s *SessionStorageDriver) SetSessionTableName(name string)
SetSessionTableName sets the name of the session table.
func (*SessionStorageDriver) SetUserPasswordHash ¶ added in v0.6.1
func (s *SessionStorageDriver) SetUserPasswordHash(ctx context.Context, userID ccc.UUID, hash *securehash.Hash) error
SetUserPasswordHash updates the user password hash
func (*SessionStorageDriver) SetUserTableName ¶ added in v0.6.1
func (s *SessionStorageDriver) SetUserTableName(name string)
SetUserTableName sets the name of the user table.
func (*SessionStorageDriver) UpdateSessionActivity ¶
UpdateSessionActivity updates the session activity column with the current time
func (*SessionStorageDriver) User ¶ added in v0.6.1
func (s *SessionStorageDriver) User(ctx context.Context, id ccc.UUID) (*dbtype.SessionUser, error)
User returns the user record associated with the user id
func (*SessionStorageDriver) UserByUserName ¶ added in v0.6.1
func (s *SessionStorageDriver) UserByUserName(ctx context.Context, username string) (*dbtype.SessionUser, error)
UserByUserName returns the user record associated with the username