Documentation ¶
Index ¶
- func DecodeGRPCCreateUserRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCCreateUserResponse(_ context.Context, grpcReply interface{}) (interface{}, error)
- func DecodeGRPCGetUserRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCGetUserResponse(_ context.Context, grpcReply interface{}) (interface{}, error)
- func DecodeHTTPCreateUserRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPCreateUserResponse(_ context.Context, r *http.Response) (interface{}, error)
- func DecodeHTTPGetUserRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPGetUserResponse(_ context.Context, r *http.Response) (interface{}, error)
- func EncodeGRPCCreateUserRequest(_ context.Context, request interface{}) (interface{}, error)
- func EncodeGRPCCreateUserResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeGRPCGetUserRequest(_ context.Context, request interface{}) (interface{}, error)
- func EncodeGRPCGetUserResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeHTTPGenericRequest(_ context.Context, r *http.Request, request interface{}) error
- func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
- func EndpointMetricsMiddleware(duration metrics.TimeHistogram) endpoint.Middleware
- func MakeCreateUserEndpoint(s UserService) endpoint.Endpoint
- func MakeGRPCServer(ctx context.Context, endpoints Endpoints, logger log.Logger) pb.UserServiceServer
- func MakeGetUserEndpoint(s UserService) endpoint.Endpoint
- func MakeHTTPHandler(ctx context.Context, endpoints Endpoints, logger log.Logger) http.Handler
- type CreateUserRequest
- type CreateUserResponse
- type Endpoints
- type GetUserRequest
- type GetUserResponse
- type Middleware
- type User
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeGRPCCreateUserRequest ¶
DecodeGRPCCreateUserRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC create user request to a user-domain create user request. Primarily useful in a server.
func DecodeGRPCCreateUserResponse ¶
DecodeGRPCCreateUserResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC create user response to a user-domain create user response. Primarily useful in a client.
func DecodeGRPCGetUserRequest ¶
DecodeGRPCGetUserRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC get user request to a user-domain get user request. Primarily useful in a server.
func DecodeGRPCGetUserResponse ¶
DecodeGRPCGetUserResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC get user response to a user-domain get user response. Primarily useful in a client.
func DecodeHTTPCreateUserRequest ¶
DecodeHTTPSumRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded sum request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPCreateUserResponse ¶
DecodeHTTPSumResponse is a transport/http.DecodeResponseFunc that decodes a JSON-encoded sum response from the HTTP response body. If the response has a non-200 status code, we will interpret that as an error and attempt to decode the specific error message from the response body. Primarily useful in a client.
func DecodeHTTPGetUserRequest ¶
DecodeHTTPConcatRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded concat request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPGetUserResponse ¶
DecodeHTTPConcatResponse is a transport/http.DecodeResponseFunc that decodes a JSON-encoded concat response from the HTTP response body. If the response has a non-200 status code, we will interpret that as an error and attempt to decode the specific error message from the response body. Primarily useful in a client.
func EncodeGRPCCreateUserRequest ¶
EncodeGRPCCreateUserRequest is a transport/grpc.EncodeRequestFunc that converts a user-domain Create User request to a gRPC Create User request. Primarily useful in a client.
func EncodeGRPCCreateUserResponse ¶
EncodeGRPCCreateUserResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain Create User response to a gRPC Create User reply. Primarily useful in a server.
func EncodeGRPCGetUserRequest ¶
EncodeGRPCGetUserRequest is a transport/grpc.EncodeRequestFunc that converts a user-domain Get User request to a gRPC Get User request. Primarily useful in a client.
func EncodeGRPCGetUserResponse ¶
EncodeGRPCGetUserResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain Get User response to a gRPC Get User reply. Primarily useful in a server.
func EncodeHTTPGenericRequest ¶
EncodeHTTPGenericRequest is a transport/http.EncodeRequestFunc that JSON-encodes any request to the request body. Primarily useful in a client.
func EncodeHTTPGenericResponse ¶
func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
EncodeHTTPGenericResponse is a transport/http.EncodeResponseFunc that encodes the response as JSON to the response writer. Primarily useful in a server.
func EndpointLoggingMiddleware ¶
func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
func EndpointMetricsMiddleware ¶
func EndpointMetricsMiddleware(duration metrics.TimeHistogram) endpoint.Middleware
func MakeCreateUserEndpoint ¶
func MakeCreateUserEndpoint(s UserService) endpoint.Endpoint
func MakeGRPCServer ¶
func MakeGetUserEndpoint ¶
func MakeGetUserEndpoint(s UserService) endpoint.Endpoint
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct {
User *User
}
type CreateUserResponse ¶
type Endpoints ¶
func (Endpoints) CreateUser ¶
CreateUser implements Service. Primarily useful in a client.
type GetUserRequest ¶
type GetUserRequest struct {
Id string
}
type GetUserResponse ¶
type Middleware ¶
type Middleware func(UserService) UserService
func ServiceLoggingMiddleware ¶
func ServiceLoggingMiddleware(logger log.Logger) Middleware
func ServiceMetricsMiddleware ¶
func ServiceMetricsMiddleware(gets metrics.Counter, creates metrics.Counter) Middleware
type UserService ¶
type UserService interface { CreateUser(cxt context.Context, user *User) (*User, error) GetUser(cxt context.Context, id string) (*User, error) }
func NewBasicService ¶
func NewBasicService() UserService