endpoint

package
v0.0.0-...-ca40f45 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentingMiddleware

func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware

InstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) endpoint.Middleware

LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.

func MakeCheckHomeEndpoint

func MakeCheckHomeEndpoint(s service.Service) endpoint.Endpoint

func MakeCreateCrimeEndpoint

func MakeCreateCrimeEndpoint(s service.Service) endpoint.Endpoint

func MakeCreateHomeEndpoint

func MakeCreateHomeEndpoint(s service.Service) endpoint.Endpoint

func MakeDeleteCrimeEndpoint

func MakeDeleteCrimeEndpoint(s service.Service) endpoint.Endpoint

func MakeDeleteHomeEndpoint

func MakeDeleteHomeEndpoint(s service.Service) endpoint.Endpoint

func MakeGetCrimeEndpoint

func MakeGetCrimeEndpoint(s service.Service) endpoint.Endpoint

func MakeGetCrimesEndpoint

func MakeGetCrimesEndpoint(s service.Service) endpoint.Endpoint

func MakeGetHomeEndpoint

func MakeGetHomeEndpoint(s service.Service) endpoint.Endpoint

func MakeUpdateCrimeEndpoint

func MakeUpdateCrimeEndpoint(s service.Service) endpoint.Endpoint

Types

type CheckHomeRequest

type CheckHomeRequest struct {
	ID int64
}

type CheckHomeResponse

type CheckHomeResponse struct {
	LocationName string  `json:"location_name"`
	Description  string  `json:"description"`
	Url          string  `json:"url"`
	Distance     float64 `json:"distance"`
	MapImage     []byte  `json:"map_image"`
}

type CreateCrimeRequest

type CreateCrimeRequest struct {
	domain.Crime
}

type CreateHomeRequest

type CreateHomeRequest struct {
	ID        int64   `json:"id"`
	FirstName string  `json:"first_name"`
	LastName  string  `json:"last_name"`
	UserName  string  `json:"user_name"`
	Longitude float64 `json:"longitude"`
	Latitude  float64 `json:"latitude"`
	Image     string  `json:"image"`
}

type CreateHomeResponse

type CreateHomeResponse struct {
	domain.Home
}

type DeleteCrimeRequest

type DeleteCrimeRequest struct {
	ID int64
}

type DeleteHomeRequest

type DeleteHomeRequest struct {
	ID int64
}

type DeleteHomeResponse

type DeleteHomeResponse struct{}

type Endpoints

type Endpoints struct {
	CreateCrime endpoint.Endpoint
	GetCrimes   endpoint.Endpoint
	GetCrime    endpoint.Endpoint
	UpdateCrime endpoint.Endpoint
	DeleteCrime endpoint.Endpoint

	CreateHome endpoint.Endpoint
	GetHome    endpoint.Endpoint
	DeleteHome endpoint.Endpoint
	CheckHome  endpoint.Endpoint
}

func NewEndpointsFactory

func NewEndpointsFactory(s service.Service, logger log.Logger, duration metrics.Histogram) Endpoints

type GetCrimeRequest

type GetCrimeRequest struct {
	ID int64
}

type GetCrimeResponse

type GetCrimeResponse struct {
	domain.Crime
}

type GetCrimesRequest

type GetCrimesRequest struct {
}

type GetCrimesResponse

type GetCrimesResponse struct {
	Crimes []domain.Crime `json:"crimes"`
}

type GetHomeRequest

type GetHomeRequest struct {
	ID int64
}

type GetHomeResponse

type GetHomeResponse struct {
	domain.Home
}

type UpdateCrimeRequest

type UpdateCrimeRequest struct {
	domain.Crime
}

Jump to

Keyboard shortcuts

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