Documentation
¶
Index ¶
- func HandleLiveness(w http.ResponseWriter, r *http.Request)
- func RegisterEndpoints(mux *http.ServeMux, cfg *ApiConfig)
- func RespondWithError(w http.ResponseWriter, code int, msg string)
- type ApiConfig
- func (cfg *ApiConfig) CacheImages() error
- func (cfg *ApiConfig) GetNuthatchBirds(page, pageSize int) (BirdsJson, error)
- func (cfg *ApiConfig) HandleReadiness(w http.ResponseWriter, r *http.Request)
- func (cfg *ApiConfig) PopulateBirdDB() error
- func (cfg *ApiConfig) PopulateRatingsDB() error
- func (cfg *ApiConfig) PresignImageURL(storedURL string) string
- func (cfg *ApiConfig) ScoreMatch(winner, loser database.Bird) error
- type Bird
- type BirdsJson
- type HealthStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleLiveness ¶
func HandleLiveness(w http.ResponseWriter, r *http.Request)
func RegisterEndpoints ¶
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, msg string)
Types ¶
type ApiConfig ¶
type ApiConfig struct {
NuthatcherApiKey string
DbURL string
DbQueries *database.Queries
Db *sql.DB
S3Client *s3.Client
BucketName string
// contains filtered or unexported fields
}
func (*ApiConfig) CacheImages ¶
func (*ApiConfig) GetNuthatchBirds ¶
func (*ApiConfig) HandleReadiness ¶
func (cfg *ApiConfig) HandleReadiness(w http.ResponseWriter, r *http.Request)
func (*ApiConfig) PopulateBirdDB ¶
func (*ApiConfig) PopulateRatingsDB ¶
func (*ApiConfig) PresignImageURL ¶
PresignImageURL returns a presigned URL for a Tigris object, cached for 23 hours. Caching ensures all users get the same URL for the same image, allowing browsers to cache the fetched image across page loads. Falls back to the stored URL unchanged for non-Tigris images.
type Bird ¶
type Bird struct {
Images []string `json:"images"`
LengthMin string `json:"lengthMin"`
LengthMax string `json:"lengthMax"`
Name string `json:"name"`
ID int `json:"id"`
SciName string `json:"sciName"`
Region []string `json:"region"`
Family string `json:"family"`
Order string `json:"order"`
Status string `json:"status"`
WingspanMin string `json:"wingspanMin,omitempty"`
WingspanMax string `json:"wingspanMax,omitempty"`
}
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
}
Click to show internal directories.
Click to hide internal directories.