delivery

package
v0.0.0-...-3122bcc Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryHandler

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

func NewCategoryHandler

func NewCategoryHandler(service ICategoryService) (*CategoryHandler, error)

func (*CategoryHandler) GetFullCategories

func (c *CategoryHandler) GetFullCategories(w http.ResponseWriter, r *http.Request)

GetFullCategories godoc

@Summary    get all categories
@Description  get all categories
@Tags category
@Produce    json
@Success    200  {object} CategoryListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error"
@Router      /category/get_full [get]

func (*CategoryHandler) SearchCategoryHandler

func (c *CategoryHandler) SearchCategoryHandler(w http.ResponseWriter, r *http.Request)

SearchCategoryHandler godoc

@Summary    search category
@Description  search top 5 common named categories
@Tags category
@Produce    json
@Param      searched  query string true  "searched string"
@Success    200  {object} CategoryListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error"
@Router      /category/search [get]

type CategoryListResponse

type CategoryListResponse struct {
	Status int                `json:"status"`
	Body   []*models.Category `json:"body"`
}

func NewCategoryListResponse

func NewCategoryListResponse(body []*models.Category) *CategoryListResponse

func (CategoryListResponse) MarshalEasyJSON

func (v CategoryListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CategoryListResponse) MarshalJSON

func (v CategoryListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CategoryListResponse) UnmarshalEasyJSON

func (v *CategoryListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CategoryListResponse) UnmarshalJSON

func (v *CategoryListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ICategoryService

type ICategoryService interface {
	GetFullCategories(ctx context.Context) ([]*models.Category, error)
	SearchCategory(ctx context.Context, searchInput string) ([]*models.Category, error)
}

Jump to

Keyboard shortcuts

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