Documentation
¶
Index ¶
- Constants
- type Option
- type Store
- func (s *Store) Close()
- func (s *Store) Create(ctx context.Context, user *entity.User) error
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) GetByEmail(ctx context.Context, email string) (*entity.User, error)
- func (s *Store) GetByID(ctx context.Context, id string) (*entity.User, error)
- func (s *Store) GetPasswordHash(ctx context.Context, userID string) (string, error)
- func (s *Store) GetRefreshToken(ctx context.Context, hash string) (*entity.RefreshToken, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) RevokeTokens(ctx context.Context, hash string) error
- func (s *Store) SavePasswordHash(ctx context.Context, userID, hash string) error
- func (s *Store) SaveRefreshToken(ctx context.Context, token *entity.RefreshToken) error
- func (s *Store) TablePrefix() string
Constants ¶
const DefaultQueryTimeout = "5000" // 5 seconds in milliseconds
DefaultQueryTimeout is the default timeout for database queries. Can be overridden via DSN parameter: ?statement_timeout=5000
const DefaultTablePrefix = ""
DefaultTablePrefix is the default prefix for table names. Empty by default for backward compatibility.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Store)
Option configures the Store.
func WithTablePrefix ¶
WithTablePrefix sets the table name prefix.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements UserStore, TokenStore, and CredentialStore using PostgreSQL.
func NewWithDSN ¶
NewWithDSN creates a new PostgreSQL store from a connection string.
func (*Store) GetByEmail ¶
GetByEmail retrieves a user by email address.
func (*Store) GetPasswordHash ¶
GetPasswordHash retrieves a password hash for a user.
func (*Store) GetRefreshToken ¶
GetRefreshToken retrieves a refresh token by its hash.
func (*Store) RevokeTokens ¶
RevokeTokens revokes a token and all tokens in its family.
func (*Store) SavePasswordHash ¶
SavePasswordHash stores a password hash for a user.
func (*Store) SaveRefreshToken ¶
SaveRefreshToken persists a refresh token.
func (*Store) TablePrefix ¶
TablePrefix returns the current table prefix.