Documentation ¶
Index ¶
- type Controller
- type TodoController
- func (t *TodoController) DeleteAll(w http.ResponseWriter, r *http.Request)
- func (t *TodoController) DeleteOne(w http.ResponseWriter, r *http.Request, id string)
- func (t *TodoController) GetAll(w http.ResponseWriter, r *http.Request)
- func (t *TodoController) GetOne(w http.ResponseWriter, r *http.Request, id string)
- func (t *TodoController) Options(w http.ResponseWriter, r *http.Request)
- func (t *TodoController) PatchAll(w http.ResponseWriter, r *http.Request)
- func (t *TodoController) PatchOne(w http.ResponseWriter, r *http.Request, id string)
- func (t *TodoController) PostAll(w http.ResponseWriter, r *http.Request)
- func (t *TodoController) PostOne(w http.ResponseWriter, r *http.Request, id string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { GetOne(w http.ResponseWriter, r *http.Request, id string) GetAll(w http.ResponseWriter, r *http.Request) PostOne(w http.ResponseWriter, r *http.Request, id string) PostAll(w http.ResponseWriter, r *http.Request) PatchOne(w http.ResponseWriter, r *http.Request, id string) PatchAll(w http.ResponseWriter, r *http.Request) DeleteOne(w http.ResponseWriter, r *http.Request, id string) DeleteAll(w http.ResponseWriter, r *http.Request) Options(w http.ResponseWriter, r *http.Request) }
Controller is an abstract base type for MVC controllers
type TodoController ¶
type TodoController struct {
// contains filtered or unexported fields
}
TodoController is a MVC controller to handle todo requests
func Todo ¶
func Todo(database *database.Database) *TodoController
Todo is a constructor for TodoControllers
func (*TodoController) DeleteAll ¶
func (t *TodoController) DeleteAll(w http.ResponseWriter, r *http.Request)
DeleteAll deletes all todos
func (*TodoController) DeleteOne ¶
func (t *TodoController) DeleteOne(w http.ResponseWriter, r *http.Request, id string)
DeleteOne deletes a todo by given ID
func (*TodoController) GetAll ¶
func (t *TodoController) GetAll(w http.ResponseWriter, r *http.Request)
GetAll lists all todos
func (*TodoController) GetOne ¶
func (t *TodoController) GetOne(w http.ResponseWriter, r *http.Request, id string)
GetOne retrieves and shows a todo by given ID
func (*TodoController) Options ¶
func (t *TodoController) Options(w http.ResponseWriter, r *http.Request)
Options returns server options data
func (*TodoController) PatchAll ¶
func (t *TodoController) PatchAll(w http.ResponseWriter, r *http.Request)
PatchAll requests(PATCHs without an ID) is not allowed
func (*TodoController) PatchOne ¶
func (t *TodoController) PatchOne(w http.ResponseWriter, r *http.Request, id string)
PatchOne updates a todo with given ID
func (*TodoController) PostAll ¶
func (t *TodoController) PostAll(w http.ResponseWriter, r *http.Request)
PostAll creates a todo
func (*TodoController) PostOne ¶
func (t *TodoController) PostOne(w http.ResponseWriter, r *http.Request, id string)
PostOne requests(POSTs with an ID) is not allowed
Click to show internal directories.
Click to hide internal directories.