controller

package
v0.0.0-...-269c96b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL