Documentation ¶
Overview ¶
Package middleware implements middleware functions. It contains both app-specific middleware functions, as well as more generic ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachUserAndLogger ¶
func AttachUserAndLogger[Ctx context.Context, In, Out any](h th.Handler[MyAppContext, In, Out]) th.Handler[Ctx, In, Out]
AttachUserAndLogger fetches and attaches the user ID and attaches a request-specific logger.
Types ¶
type MyAppContext ¶
type MyAppContext struct { context.Context UserID UserID Logger logrus.FieldLogger }
MyAppContext contains the UserID and a request-specific logger.
func (MyAppContext) InnerContext ¶
func (mac MyAppContext) InnerContext() context.Context
InnerContext implements the typedcontext.TypedContext interface.
func (MyAppContext) WithInnerContext ¶
func (mac MyAppContext) WithInnerContext(ctx context.Context) MyAppContext
WithInnerContext implements the typedcontext.TypedContext interface.
Click to show internal directories.
Click to hide internal directories.