Help us shape the future of Go! Take the 2026 Go Developer Survey

transport

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 1 Imported by: 0

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

type HandlerFunc[Req any, Resp any] func(context.Context, Req) (Resp, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL