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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CityHandler

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

func NewCityHandler

func NewCityHandler(service ICityService) (*CityHandler, error)

func (*CityHandler) GetFullCitiesHandler

func (c *CityHandler) GetFullCitiesHandler(w http.ResponseWriter, r *http.Request)

GetFullCitiesHandler godoc

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

func (*CityHandler) SearchCityHandler

func (c *CityHandler) SearchCityHandler(w http.ResponseWriter, r *http.Request)

SearchCityHandler godoc

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

type CityListResponse

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

func NewCityListResponse

func NewCityListResponse(body []*models.City) *CityListResponse

func (CityListResponse) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (CityListResponse) MarshalJSON

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

MarshalJSON supports json.Marshaler interface

func (*CityListResponse) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CityListResponse) UnmarshalJSON

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

UnmarshalJSON supports json.Unmarshaler interface

type ICityService

type ICityService interface {
	GetFullCities(ctx context.Context) ([]*models.City, error)
	SearchCity(ctx context.Context, searchInput string) ([]*models.City, error)
}

Jump to

Keyboard shortcuts

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