Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Store Store
}
Config holds the configuration for serving the apikey endpoints
func (*Config) SetupHandlers ¶
SetupHandlers adds the apikey HTTP handlers to the given router
type Create ¶
type Create struct {
Name string
}
Create defines the parameters passed when creating an
type New ¶
type New struct { ID string UserID string `json:"userId" db:"user_id"` Name string Key string LastUsed time.Time `json:"lastUsed" db:"last_used"` CreatedAt time.Time `json:"createdAt" db:"created_at"` }
New represents a newly created API key and is the only struct exposing the Key itself
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
SQLStore is an SQL-backed implementation of a Store
func NewTestSQLStore ¶
NewTestSQLStore allow build a Store with custom generators
type Store ¶
type Store interface { Create(string, *Create) (*New, error) Delete(string, string) (*Struct, error) GetByKey(string) (*Struct, error) List(string) ([]*Struct, error) }
The Store interface defines functions for interacting and managing API keys
type Struct ¶
type Struct struct { ID string `json:"id"` Name string `json:"name"` UserID string `json:"userId" db:"user_id"` LastUsed time.Time `json:"lastUsed" db:"last_used"` CreatedAt time.Time `json:"createdAt" db:"created_at"` }
Struct represents a key that can be used via to interact with an API as an authenticated user.
The Key itself is not exposed.
Click to show internal directories.
Click to hide internal directories.