endpoints

package
v0.0.0-...-ec6daaa Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCreateRequest

func DecodeCreateRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeDeleteRequest

func DecodeDeleteRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeGetByIDRequest

func DecodeGetByIDRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeQuantityOrderedRequest

func DecodeQuantityOrderedRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSearchRequest

func DecodeSearchRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeTopRequest

func DecodeTopRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeTotalRequest

func DecodeTotalRequest(ctx context.Context, r *http.Request) (interface{}, error)

func EncodeResponse

func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func MakeCreateEndpoint

func MakeCreateEndpoint(svc service.Service) endpoint.Endpoint

func MakeDeleteEndpoint

func MakeDeleteEndpoint(svc service.Service) endpoint.Endpoint

func MakeGetByIDEndpoint

func MakeGetByIDEndpoint(svc service.Service) endpoint.Endpoint

func MakeQuantityOrderedEndpoint

func MakeQuantityOrderedEndpoint(svc service.Service) endpoint.Endpoint

func MakeSearchEndpoint

func MakeSearchEndpoint(svc service.Service) endpoint.Endpoint

func MakeTopEndpoint

func MakeTopEndpoint(svc service.Service) endpoint.Endpoint

func MakeTotalEndpoint

func MakeTotalEndpoint(svc service.Service) endpoint.Endpoint

func ParseIDFromURL

func ParseIDFromURL(r *http.Request) (uint, error)

Types

type CreateRequest

type CreateRequest struct {
	Data database.OrderIn `json:"data"`
}

type CreateResponse

type CreateResponse struct {
	Message string `json:"message"`
}

type DeleteRequest

type DeleteRequest struct {
	ID uint `json:"id,omitempty"`
}

type DeleteResponse

type DeleteResponse struct {
	Message string `json:"message"`
}

type EndpointSet

type EndpointSet struct {
	GetByIDEndpoint         endpoint.Endpoint
	SearchEndpoint          endpoint.Endpoint
	CreateEndpoint          endpoint.Endpoint
	DeleteEndpoint          endpoint.Endpoint
	TotalEndpoint           endpoint.Endpoint
	TopEndpoint             endpoint.Endpoint
	QuantityOrderedEndpoint endpoint.Endpoint
}

func NewEndpointSet

func NewEndpointSet(svc service.Service) EndpointSet

type GetByIDRequest

type GetByIDRequest struct {
	ID uint `json:"id,omitempty"`
}

type GetByIDResponse

type GetByIDResponse struct {
	OrderItems []database.OrderItemOut `json:"orderItems"`
}

type QuantityOrderedRequest

type QuantityOrderedRequest struct {
	ID uint `json:"id"`
}

type QuantityOrderedResponse

type QuantityOrderedResponse struct {
	Quantity uint `json:"quantity"`
}

type SearchRequest

type SearchRequest struct {
	Search    string    `json:"search"`
	StartDate time.Time `json:"startDate"`
	EndDate   time.Time `json:"endDate"`
}

type SearchResponse

type SearchResponse struct {
	Orders []database.OrderOut `json:"orders"`
}

type TopRequest

type TopRequest struct {
	Count uint `json:"count"`
}

type TopResponse

type TopResponse struct {
	Products []database.ProductOutTop `json:"products"`
}

type TotalRequest

type TotalRequest struct {
}

type TotalResponse

type TotalResponse struct {
	Total float32 `json:"total"`
}

Jump to

Keyboard shortcuts

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