Documentation
¶
Overview ¶
Package transport provides transport-layer abstractions for HTTP and RPC handlers.
HandlerFunc is a generic request handler that can be decorated with logging, metrics, and recovery via the decorators sub-package. Protocol-specific implementations live in the rest/ and rpc/ sub-packages.
Sub-packages ¶
- rest: HTTP response helpers (BaseController), request-to-handler adapter (Adapt)
- rpc: Connect/gRPC error mapping (ToConnectError, FromRPCError)
- decorators: Fluent decorator composition (HandlerBuilder)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is a generic request handler function that processes a request and returns a response. This is the transport-layer equivalent of Pipeline/Workflow Execute, applied to individual handlers.
HandlerFunc is protocol-agnostic: it works with both REST and RPC transports. Use the decorators.HandlerBuilder to wrap handlers with cross-cutting concerns.
Example:
handler := func(ctx context.Context, req LoginRequest) (LoginResponse, error) {
// Validate, call workflow, serialize
return LoginResponse{Token: "..."}, nil
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package decorators provides fluent decorator composition for transport handlers.
|
Package decorators provides fluent decorator composition for transport handlers. |
|
Package docs provides reusable HTTP handlers for serving OpenAPI specs and Redoc UI documentation pages.
|
Package docs provides reusable HTTP handlers for serving OpenAPI specs and Redoc UI documentation pages. |
|
Package jsonapi provides HTTP middleware that transforms Vanguard REST responses into [JSON:API](https://jsonapi.org/format/) envelope format.
|
Package jsonapi provides HTTP middleware that transforms Vanguard REST responses into [JSON:API](https://jsonapi.org/format/) envelope format. |
|
Package rest provides HTTP response helpers for REST API handlers.
|
Package rest provides HTTP response helpers for REST API handlers. |
|
Package rpc provides Connect RPC utilities for bidirectional mapping between domain AppErrors and Connect/gRPC status codes.
|
Package rpc provides Connect RPC utilities for bidirectional mapping between domain AppErrors and Connect/gRPC status codes. |