Documentation
¶
Overview ¶
The requestid package creates a middleware the generates and injects a unique request id into the request context and response header.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogHandler ¶
func LogHandler(key string) middleware
LogHandler adds a zerolog/hlog middleware handler to inject the request id into the log context with the desired key.
func New ¶
func New(opts ...option) middleware
Returns a new requestid middleware with the requested options.
func WithGenerator ¶
func WithGenerator(g generator) option
Override the ID generation function which defaults to a v4 UUID.
func WithHeader ¶
func WithHeader(h string) option
Override the request id header from the default "X-Request-ID".
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.