Documentation ¶
Index ¶
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeAddEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
- func MakeDeleteEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
- func MakeListEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
- func MakeUpdateEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
- type AddRequest
- type AddResponse
- type CompleteAllResponse
- type DeleteRequest
- type DeleteResponse
- type Endpoints
- func (e Endpoints) Add(ctx context.Context, todo *model.TodoReq) (res *model.TodoRes, err error)
- func (e Endpoints) Delete(ctx context.Context, id string) (err error)
- func (e Endpoints) List(ctx context.Context) (res []*model.TodoRes, err error)
- func (e Endpoints) Update(ctx context.Context, id string, todo *model.TodoReq) (res *model.TodoRes, err error)
- type ListRequest
- type ListResponse
- type Request
- type UpdateRequest
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 MakeAddEndpoint ¶
func MakeAddEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
MakeAddEndpoint returns an endpoint that invokes Add on the service. Primarily useful in a server.
func MakeDeleteEndpoint ¶
func MakeDeleteEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
MakeDeleteEndpoint returns an endpoint that invokes Delete on the service. Primarily useful in a server.
func MakeListEndpoint ¶
func MakeListEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
MakeListEndpoint returns an endpoint that invokes List on the service. Primarily useful in a server.
func MakeUpdateEndpoint ¶
func MakeUpdateEndpoint(svc service.TodoService) (ep endpoint.Endpoint)
MakeUpdateEndpoint returns an endpoint that invokes Update on the service. Primarily useful in a server.
Types ¶
type AddRequest ¶
AddRequest collects the request parameters for the Add method.
type AddResponse ¶
AddResponse collects the response values for the Add method.
func (AddResponse) Headers ¶
func (r AddResponse) Headers() http.Header
func (AddResponse) Response ¶
func (r AddResponse) Response() interface{}
func (AddResponse) StatusCode ¶
func (r AddResponse) StatusCode() int
type CompleteAllResponse ¶
type CompleteAllResponse struct {
Err error `json:"-"`
}
CompleteAllResponse collects the response values for the CompleteAll method.
type DeleteRequest ¶
type DeleteRequest struct {
Id string `json:"id"`
}
DeleteRequest collects the request parameters for the Delete method.
type DeleteResponse ¶
type DeleteResponse struct {
Err error `json:"-"`
}
DeleteResponse collects the response values for the Delete method.
func (DeleteResponse) Headers ¶
func (r DeleteResponse) Headers() http.Header
func (DeleteResponse) Response ¶
func (r DeleteResponse) Response() interface{}
func (DeleteResponse) StatusCode ¶
func (r DeleteResponse) StatusCode() int
type Endpoints ¶
type Endpoints struct { AddEndpoint endpoint.Endpoint `json:""` DeleteEndpoint endpoint.Endpoint `json:""` UpdateEndpoint endpoint.Endpoint `json:""` ListEndpoint endpoint.Endpoint `json:""` }
Endpoints collects all of the endpoints that compose the todo service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
func AuthnMiddleware ¶
func AuthnMiddleware(n endpoint.Middleware, endpoints Endpoints) Endpoints
AuthnMiddleware returns an endpoint middleware that apply authentication func
func AuthzMiddleware ¶
func AuthzMiddleware(z func(action string, resource string) endpoint.Middleware, endpoints Endpoints) Endpoints
AuthzMiddleware returns an endpoint middleware that apply authorization func (opa rbac)
func New ¶
func New(svc service.TodoService, logger log.Logger, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer) (ep Endpoints)
New return a new instance of the endpoint that wraps the provided service.
func (Endpoints) Add ¶
Add implements the service interface, so Endpoints may be used as a service. This is primarily useful in the context of a client library.
func (Endpoints) Delete ¶
Delete implements the service interface, so Endpoints may be used as a service. This is primarily useful in the context of a client library.
type ListRequest ¶
type ListRequest struct { }
ListRequest collects the request parameters for the List method.
type ListResponse ¶
ListResponse collects the response values for the List method.
func (ListResponse) Headers ¶
func (r ListResponse) Headers() http.Header
func (ListResponse) Response ¶
func (r ListResponse) Response() interface{}
func (ListResponse) StatusCode ¶
func (r ListResponse) StatusCode() int
type UpdateRequest ¶
UpdateRequest collects the request parameters for the Update method.
type UpdateResponse ¶
UpdateResponse collects the response values for the Update method.
func (UpdateResponse) Headers ¶
func (r UpdateResponse) Headers() http.Header
func (UpdateResponse) Response ¶
func (r UpdateResponse) Response() interface{}
func (UpdateResponse) StatusCode ¶
func (r UpdateResponse) StatusCode() int