Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyEndpoint ¶ added in v1.2.6
type AnyEndpointFunc ¶ added in v1.2.6
type AnyEndpointFunc EndpointFunc[any, any]
type Endpoint ¶
type Endpoint[Req any, Resp any] interface { Invoke(ctx context.Context, request Req) (Resp, error) }
Endpoint represents a single RPC method.
type EndpointFunc ¶
The EndpointFunc type is an adapter to allow the use of ordinary functions as Endpoint.
type Middleware ¶
type Middleware[Request any, Response any] interface { // Decorate wraps the underlying Endpoint, adding some functionality. Decorate(ep Endpoint[Request, Response]) Endpoint[Request, Response] }
Middleware allows us to write something like decorators to Endpoint. It can execute something before invoke or after.
type MiddlewareFunc ¶
type MiddlewareFunc[Request any, Response any] func(ep Endpoint[Request, Response]) Endpoint[Request, Response]
The MiddlewareFunc type is an adapter to allow the use of ordinary functions as Middleware.
func (MiddlewareFunc[Request, Response]) Decorate ¶
func (f MiddlewareFunc[Request, Response]) Decorate(ep Endpoint[Request, Response]) Endpoint[Request, Response]
Decorate call f(endpoint).
Click to show internal directories.
Click to hide internal directories.