Documentation ¶
Index ¶
- type Controller
- func (c Controller) Create(req *restful.Request, resp *restful.Response, form forms.PersonForm)
- func (c Controller) Delete(req *restful.Request, resp *restful.Response)
- func (c Controller) Edit(req *restful.Request, resp *restful.Response, form forms.PersonForm)
- func (c Controller) ErrorHandler(req *restful.Request, resp *restful.Response, errormessage string)
- func (c Controller) Index(req *restful.Request, resp *restful.Response, form forms.ListForm)
- func (c Controller) New(req *restful.Request, resp *restful.Response, form forms.PersonForm)
- func (c *Controller) SetServices(services services.Services)
- func (c Controller) Show(req *restful.Request, resp *restful.Response, form forms.PersonForm)
- func (c Controller) Update(req *restful.Request, resp *restful.Response, form forms.PersonForm)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func MakeController ¶
func MakeController(services services.Services) Controller
MakeController is a factory that creates a people controller
func (Controller) Create ¶
func (c Controller) Create(req *restful.Request, resp *restful.Response, form forms.PersonForm)
Create creates a new person using the data from the HTTP form displayed by a previous NEW request.
func (Controller) Delete ¶
func (c Controller) Delete(req *restful.Request, resp *restful.Response)
Delete reponds to a DELETE request and deletes the record with the given ID, eg DELETE http://server:port/people/1.
func (Controller) Edit ¶
func (c Controller) Edit(req *restful.Request, resp *restful.Response, form forms.PersonForm)
Edit fetches the data for the people record with the given ID and displays the edit page, populated with that data.
func (Controller) ErrorHandler ¶
ErrorHandler displays the index page with an error message
func (Controller) New ¶
func (c Controller) New(req *restful.Request, resp *restful.Response, form forms.PersonForm)
New displays the page to create a new person,
func (*Controller) SetServices ¶
func (c *Controller) SetServices(services services.Services)
SetServices sets the services.
func (Controller) Show ¶
func (c Controller) Show(req *restful.Request, resp *restful.Response, form forms.PersonForm)
Show displays the details of the person with the ID given in the URI.
func (Controller) Update ¶
func (c Controller) Update(req *restful.Request, resp *restful.Response, form forms.PersonForm)
Update responds to a PUT request. For example: PUT /people/1 It's invoked by the form displayed by a previous Edit request. If the ID in the URI is valid and the request parameters from the form specify valid people data, it updates the record and displays the index page with a confirmation message, otherwise it displays the edit page again with the given data and some error messages.