Documentation ¶
Index ¶
- func InitRepositoryProvider(databaseProvider string)
- type PgsqlAPIKeysRepository
- func (p *PgsqlAPIKeysRepository) AddAPIKey(userID string, comment string) (*api.APIKey, error)
- func (p *PgsqlAPIKeysRepository) DeleteAPIKey(userGUID string, keyGUID string) error
- func (p *PgsqlAPIKeysRepository) GetAPIKeyBySecret(keySecret string) (*api.APIKey, error)
- func (p *PgsqlAPIKeysRepository) ListAPIKeys(userID string) ([]api.APIKey, error)
- func (p *PgsqlAPIKeysRepository) UpdateAPIKeyLastUsed(keyGUID string) error
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitRepositoryProvider ¶
func InitRepositoryProvider(databaseProvider string)
InitRepositoryProvider - One time init for the given DB Provider
Types ¶
type PgsqlAPIKeysRepository ¶
type PgsqlAPIKeysRepository struct {
// contains filtered or unexported fields
}
PgsqlAPIKeysRepository - Postgresql-backed API keys repository
func (*PgsqlAPIKeysRepository) DeleteAPIKey ¶
func (p *PgsqlAPIKeysRepository) DeleteAPIKey(userGUID string, keyGUID string) error
DeleteAPIKey - delete an API key identified by its GUID
func (*PgsqlAPIKeysRepository) GetAPIKeyBySecret ¶
func (p *PgsqlAPIKeysRepository) GetAPIKeyBySecret(keySecret string) (*api.APIKey, error)
GetAPIKeyBySecret - gets user ID for an API key
func (*PgsqlAPIKeysRepository) ListAPIKeys ¶
func (p *PgsqlAPIKeysRepository) ListAPIKeys(userID string) ([]api.APIKey, error)
ListAPIKeys - list API keys for a given user GUID
func (*PgsqlAPIKeysRepository) UpdateAPIKeyLastUsed ¶
func (p *PgsqlAPIKeysRepository) UpdateAPIKeyLastUsed(keyGUID string) error
UpdateAPIKeyLastUsed - sets API key last_used field to current time
type Repository ¶
type Repository interface { AddAPIKey(userID string, comment string) (*api.APIKey, error) GetAPIKeyBySecret(keySecret string) (*api.APIKey, error) ListAPIKeys(userID string) ([]api.APIKey, error) DeleteAPIKey(userGUID string, keyGUID string) error UpdateAPIKeyLastUsed(keyGUID string) error }
Repository - API keys repository
func NewPgsqlAPIKeysRepository ¶
func NewPgsqlAPIKeysRepository(dcp *sql.DB) (Repository, error)
NewPgsqlAPIKeysRepository - get a reference to the API keys data source
Click to show internal directories.
Click to hide internal directories.