Documentation
¶
Index ¶
- type AttachmentForm
- type NoteForm
- type RatingForm
- type RecipeForm
- type RouteController
- func (rc *RouteController) AddNoteToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) AttachToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) CreateRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) CreateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) DeleteRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) EditRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) EditRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) GetRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) Home(resp http.ResponseWriter, req *http.Request)
- func (rc *RouteController) InternalServerError(resp http.ResponseWriter, err error)
- func (rc *RouteController) ListRecipes(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) NotFound(resp http.ResponseWriter, req *http.Request)
- func (rc *RouteController) RateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) RedirectIfHasError(resp http.ResponseWriter, err error) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachmentForm ¶
type AttachmentForm struct {
FileName string `form:"file_name"`
FileContent *multipart.FileHeader `form:"file_content"`
}
AttachmentForm encapsulates user input for attaching a file (image) to a recipe
type NoteForm ¶
type NoteForm struct {
Note string `form:"note"`
}
NoteForm encapsulates user input for a note on a recipe
type RatingForm ¶ added in v0.4.0
type RatingForm struct {
Rating float64 `form:"rating"`
}
RatingForm encapsulates user input for rating a recipe (1-5)
type RecipeForm ¶
type RecipeForm struct {
Name string `form:"name"`
Description string `form:"description"`
Ingredients string `form:"ingredients"`
Directions string `form:"directions"`
Tags []string `form:"tags"`
}
RecipeForm encapsulates user input on the Create and Edit recipe screens
type RouteController ¶ added in v0.3.0
RouteController encapsulates the routes for the application
func NewController ¶ added in v0.3.0
NewController constructs a RouteController
func (*RouteController) AddNoteToRecipePost ¶ added in v0.3.0
func (rc *RouteController) AddNoteToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
AddNoteToRecipePost handles processing the supplied form input for adding a note to a recipe
func (*RouteController) AttachToRecipePost ¶ added in v0.3.0
func (rc *RouteController) AttachToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
AttachToRecipePost handles uploading the specified attachment (image) to a recipe
func (*RouteController) CreateRecipe ¶ added in v0.3.0
func (rc *RouteController) CreateRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
CreateRecipe handles rendering the create recipe screen
func (*RouteController) CreateRecipePost ¶ added in v0.3.0
func (rc *RouteController) CreateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
CreateRecipePost handles processing the supplied form input from the create recipe screen
func (*RouteController) DeleteRecipe ¶ added in v0.3.0
func (rc *RouteController) DeleteRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
DeleteRecipe handles deleting the recipe with the given id
func (*RouteController) EditRecipe ¶ added in v0.3.0
func (rc *RouteController) EditRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
EditRecipe handles rendering the edit recipe screen
func (*RouteController) EditRecipePost ¶ added in v0.3.0
func (rc *RouteController) EditRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
EditRecipePost handles processing the supplied form input from the edit recipe screen
func (*RouteController) GetRecipe ¶ added in v0.3.0
func (rc *RouteController) GetRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
GetRecipe handles retrieving and rendering a single recipe
func (*RouteController) Home ¶ added in v0.3.0
func (rc *RouteController) Home(resp http.ResponseWriter, req *http.Request)
Home handles rending the default home page
func (*RouteController) InternalServerError ¶ added in v0.3.0
func (rc *RouteController) InternalServerError(resp http.ResponseWriter, err error)
InternalServerError handles 500 errors
func (*RouteController) ListRecipes ¶ added in v0.3.0
func (rc *RouteController) ListRecipes(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
ListRecipes handles retrieving and rending a list of available recipes
func (*RouteController) NotFound ¶ added in v0.3.0
func (rc *RouteController) NotFound(resp http.ResponseWriter, req *http.Request)
NotFound handles 404 errors
func (*RouteController) RateRecipePost ¶ added in v0.4.0
func (rc *RouteController) RateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
RateRecipePost handles adding/updating the rating of a recipe
func (*RouteController) RedirectIfHasError ¶ added in v0.3.0
func (rc *RouteController) RedirectIfHasError(resp http.ResponseWriter, err error) bool
RedirectIfHasError sends the request to the InternalServerError page if the asupplied error is not nil