Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDBConnection = errors.New("database connection error")
ErrDBConnection is returned when connection with the database fails.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when there is no sock for a given ID.
Functions ¶
func MakeGetEndpoint ¶
MakeGetEndpoint returns an endpoint via the given service.
func MakeHTTPHandler ¶
func MakeHTTPHandler(ctx context.Context, e Endpoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router
MakeHTTPHandler mounts the endpoints into a REST-y HTTP handler.
func MakeHealthEndpoint ¶
MakeHealthEndpoint returns current health of the given service.
Types ¶
type Endpoints ¶
Endpoints collects the endpoints that comprise the Service.
func MakeEndpoints ¶
func MakeEndpoints(s Service, tracer stdopentracing.Tracer) Endpoints
MakeEndpoints returns an Endpoints structure, where each endpoint is backed by the given service.
type Health ¶
type Health struct {
Service string `json:"service"`
Status string `json:"status"`
Time string `json:"time"`
}
Health describes the health of a service
type Middleware ¶
Middleware decorates a Service.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
LoggingMiddleware logs method calls, parameters, results, and elapsed time.
type Service ¶
Service is the recommender service, providing read operations on a saleable recommender of sock products.
type Sock ¶
type Sock struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
ImageURL []string `json:"imageUrl" db:"-"`
ImageURL_1 string `json:"-" db:"image_url_1"`
ImageURL_2 string `json:"-" db:"image_url_2"`
Price float32 `json:"price" db:"price"`
Count int `json:"count" db:"count"`
Tags []string `json:"tag" db:"-"`
TagString string `json:"-" db:"tag_name"`
}
Sock describes the thing on offer in the catalogue.