controller

package
v0.0.0-...-15901fa Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, message string)

RespondWithError is a function structure that errors

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON is a function that response values in json structure for http paltform

Types

type Controller

type Controller struct{}

Controller his a empty struct to append controller functions

type ProductController

type ProductController struct {
	PgDB   *sql.DB
	Router *mux.Router
}

ProductController has a struct to controller product

func (*ProductController) CreateProduct

func (c *ProductController) CreateProduct(w http.ResponseWriter, r *http.Request)

CreateProduct is a handler to create row in products

func (*ProductController) GetProduct

func (c *ProductController) GetProduct(w http.ResponseWriter, r *http.Request)

GetProduct has a controller to return profducts

func (*ProductController) GetProducts

func (c *ProductController) GetProducts(w http.ResponseWriter, r *http.Request)

GetProducts has a controller for get all products

Jump to

Keyboard shortcuts

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