Documentation ¶
Index ¶
- func ErrInternalServerError(err error) render.Renderer
- func ErrInvalidRequest(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func Handler(service service.Service) http.Handler
- func NewEntryListResponse(entries []model.Entry) []render.Renderer
- func NewShoppingListsResponse(lists []model.ShoppingList) []render.Renderer
- func NewUsersResponse(users []model.User) []render.Renderer
- type AuthenticateRequest
- type ErrResponse
- type ShoppingList
- type ShoppingListEntry
- type ShoppingListEntryRequest
- type ShoppingListEntryResponse
- type ShoppingListRequest
- type ShoppingListResponse
- type User
- type UserRequest
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrInternalServerError ¶
func ErrInvalidRequest ¶
func NewShoppingListsResponse ¶
func NewShoppingListsResponse(lists []model.ShoppingList) []render.Renderer
Types ¶
type AuthenticateRequest ¶
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code StatusText string `json:"status"` // user-level status message AppCode int64 `json:"code,omitempty"` // application-specific error code ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrResponse renderer type for handling all sorts of errors.
In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
type ShoppingList ¶
type ShoppingListEntry ¶
type ShoppingListEntryRequest ¶
type ShoppingListEntryRequest struct {
*ShoppingListEntry
}
type ShoppingListEntryResponse ¶
type ShoppingListEntryResponse struct {
*ShoppingListEntry
}
func NewEntryResponse ¶
func NewEntryResponse(entry model.Entry) *ShoppingListEntryResponse
func (*ShoppingListEntryResponse) Render ¶
func (sr *ShoppingListEntryResponse) Render(w http.ResponseWriter, r *http.Request) error
type ShoppingListRequest ¶
type ShoppingListRequest struct {
*ShoppingList
}
type ShoppingListResponse ¶
type ShoppingListResponse struct {
*ShoppingList
}
func NewShoppingListResponse ¶
func NewShoppingListResponse(list model.ShoppingList) *ShoppingListResponse
func (*ShoppingListResponse) Render ¶
func (sr *ShoppingListResponse) Render(w http.ResponseWriter, r *http.Request) error
type UserRequest ¶
type UserRequest struct {
*User
}
type UserResponse ¶
type UserResponse struct {
*User
}
func NewUserResponse ¶
func NewUserResponse(u model.User) *UserResponse
func (*UserResponse) Render ¶
func (sr *UserResponse) Render(w http.ResponseWriter, r *http.Request) error
Click to show internal directories.
Click to hide internal directories.