Documentation
¶
Overview ¶
Package v1 provides generic HTTP transport layer utilities.
Package v1 provides generic HTTP transport layer utilities.
Package v1 provides generic HTTP transport layer utilities. It defines Decoder, Encoder, and Handler interfaces with generic type constraints for building type-safe HTTP handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
Decoder defines the request decoder interface. It converts an HTTP request type to a domain request type. HTTPReq: HTTP request type DomainReq: domain request type
type Encoder ¶
Encoder defines the response encoder interface. It converts a domain response type to an HTTP response type. DomainResp: domain response type HTTPResp: HTTP response type
type Handler ¶
Handler defines the HTTP handler interface with generic type constraints. HTTPReq is the HTTP request type, HTTPResp is the HTTP response type.
func NewHandler ¶
func NewHandler[HTTPReq, DomainReq, DomainResp, HTTPResp any]( ep epv1.Endpoint[DomainReq, DomainResp], decoder Decoder[HTTPReq, DomainReq], encoder Encoder[DomainResp, HTTPResp], ) Handler[HTTPReq, HTTPResp]
NewHandler creates a new HTTP handler with the given endpoint, decoder, and encoder. The handler provides type-safe conversion between HTTP types and domain types.