Documentation ¶
Index ¶
- Variables
- func MakeAddressGetEndpoint(s Service) endpoint.Endpoint
- func MakeAddressPostEndpoint(s Service) endpoint.Endpoint
- func MakeCardGetEndpoint(s Service) endpoint.Endpoint
- func MakeCardPostEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(e Endpoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router
- func MakeHealthEndpoint(s Service) endpoint.Endpoint
- func MakeLoginEndpoint(s Service) endpoint.Endpoint
- func MakeRegisterEndpoint(s Service) endpoint.Endpoint
- func MakeUserGetEndpoint(s Service) endpoint.Endpoint
- func MakeUserPostEndpoint(s Service) endpoint.Endpoint
- type EmbedStruct
- type Endpoints
- type GetRequest
- type Health
- type Middleware
- type Service
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidRequest = errors.New("Invalid request")
)
var (
)Functions ¶
func MakeAddressGetEndpoint ¶
MakeAddressGetEndpoint returns an endpoint via the given service.
func MakeAddressPostEndpoint ¶
MakeAddressPostEndpoint returns an endpoint via the given service.
func MakeCardGetEndpoint ¶
MakeUserGetEndpoint returns an endpoint via the given service.
func MakeCardPostEndpoint ¶
MakeCardPostEndpoint returns an endpoint via the given service.
func MakeDeleteEndpoint ¶
MakeLoginEndpoint returns an endpoint via the given service.
func MakeHTTPHandler ¶
MakeHTTPHandler mounts the endpoints into a REST-y HTTP handler.
func MakeHealthEndpoint ¶
MakeHealthEndpoint returns current health of the given service.
func MakeLoginEndpoint ¶
MakeLoginEndpoint returns an endpoint via the given service.
func MakeRegisterEndpoint ¶
MakeRegisterEndpoint returns an endpoint via the given service.
func MakeUserGetEndpoint ¶
MakeUserGetEndpoint returns an endpoint via the given service.
func MakeUserPostEndpoint ¶
MakeUserPostEndpoint returns an endpoint via the given service.
Types ¶
type EmbedStruct ¶
type EmbedStruct struct {
Embed interface{} `json:"_embedded"`
}
type Endpoints ¶
type Endpoints struct { LoginEndpoint endpoint.Endpoint RegisterEndpoint endpoint.Endpoint UserGetEndpoint endpoint.Endpoint UserPostEndpoint endpoint.Endpoint AddressGetEndpoint endpoint.Endpoint AddressPostEndpoint endpoint.Endpoint CardGetEndpoint endpoint.Endpoint CardPostEndpoint endpoint.Endpoint DeleteEndpoint endpoint.Endpoint HealthEndpoint endpoint.Endpoint }
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 GetRequest ¶
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 ¶
type Service interface { Login(username, password string) (users.User, error) // GET /login Register(username, password, email, first, last string) (string, error) GetUsers(id string) ([]users.User, error) PostUser(u users.User) (string, error) GetAddresses(id string) ([]users.Address, error) PostAddress(u users.Address, userid string) (string, error) GetCards(id string) ([]users.Card, error) PostCard(u users.Card, userid string) (string, error) Delete(entity, id string) error Health() []Health // GET /health }
Service is the user service, providing operations for users to login, register, and retrieve customer information.
func NewFixedService ¶
func NewFixedService() Service
NewFixedService returns a simple implementation of the Service interface,