rest

package
v0.0.0-...-dbfc5a5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CsvResponse

func CsvResponse(w http.ResponseWriter, fileName string, message []byte)

CsvResponse

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, statusCode int, message string)

ErrorResponse

func OkResponse

func OkResponse(w http.ResponseWriter, message []byte)

OkResponse

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler

func NewHandler

func NewHandler(product Producter) *Handler

NewHandler - constructor

func (*Handler) InitRouter

func (h *Handler) InitRouter() *mux.Router

InitRouter - init routes

type Producter

type Producter interface {
	Create(ctx context.Context, product domain.Product) error
	UpdateById(ctx context.Context, id int, input domain.UpdateProductInput) error
	DeleteById(ctx context.Context, id int) error
	GetAllProducts(ctx context.Context) ([]domain.Product, error)
}

Producter - transport contract (handler)

Jump to

Keyboard shortcuts

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