Documentation ¶
Index ¶
- type AppError
- func AuthenticateOrganization(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
- func CreateOrganization(w http.ResponseWriter, r *http.Request, o *model.Organization) *AppError
- func ErrCreatingModel(err error) *AppError
- func ErrDatabase(err error) *AppError
- func ErrInvalidID(err error) *AppError
- func ErrNotFound(err error) *AppError
- func ErrUnauthorized() *AppError
- func ErrUnmarshalling(err error) *AppError
- func GetAllOrganizations(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
- func GetAllShelters(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
- func GetOrganization(w http.ResponseWriter, r *http.Request, o *model.Organization) *AppError
- func GetShelter(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
- type AppHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppError ¶
type AppError struct { Error error `json:"-"` Message string `json:"message"` Code int `json:"code"` }
AppError represents an error as returned by this application. It works in tandem with AppHandler for easy handling of errors.
func AuthenticateOrganization ¶
func AuthenticateOrganization(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
func CreateOrganization ¶
func CreateOrganization(w http.ResponseWriter, r *http.Request, o *model.Organization) *AppError
func ErrCreatingModel ¶
func ErrDatabase ¶
func ErrInvalidID ¶
func ErrNotFound ¶
func ErrUnauthorized ¶
func ErrUnauthorized() *AppError
func ErrUnmarshalling ¶
func GetAllOrganizations ¶
func GetAllOrganizations(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
func GetAllShelters ¶
func GetAllShelters(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
func GetOrganization ¶
func GetOrganization(w http.ResponseWriter, r *http.Request, o *model.Organization) *AppError
func GetShelter ¶
func GetShelter(w http.ResponseWriter, r *http.Request, _ *model.Organization) *AppError
type AppHandler ¶
type AppHandler func(http.ResponseWriter, *http.Request, *model.Organization) *AppError
AppHandler is a type that implements http.Handler and makes handling errors easier. When its method returns an error, it prints it to the logs and shows a JSON formatted error to the user.
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.