Documentation ¶
Index ¶
- Variables
- func BookIdPathParam(r *http.Request) (int, error)
- func Param(r *http.Request, key string) string
- func RespondWithError(w http.ResponseWriter, code int, message string)
- func RespondWithJson(w http.ResponseWriter, code int, payload interface{})
- func RespondWithStatus(w http.ResponseWriter, code int)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidBookId = errors.New("invalid book id")
ErrInvalidBookId is an error representing an invalid or malformed book ID.
Functions ¶
func BookIdPathParam ¶
BookIdPathParam extracts the 'id' parameter from the path of an HTTP request and converts it to an integer.
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, message string)
RespondWithError responds a json with an error message
func RespondWithJson ¶
func RespondWithJson(w http.ResponseWriter, code int, payload interface{})
RespondWithJson responds a json with an error message
func RespondWithStatus ¶
func RespondWithStatus(w http.ResponseWriter, code int)
RespondWithStatus responds with an HTTP status code
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.