requestctx

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package requestctx provides access to special fields in the http request's context

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(ctx context.Context) string

ID returns the request ID from the context

func Logger added in v0.4.0

func Logger(ctx context.Context) logr.Logger

Logger returns the logger from the context

func User

func User(ctx context.Context) auth.User

User returns the User from the context

func WithID added in v0.4.0

func WithID(ctx context.Context, val string) context.Context

WithID adds the request ID to the context

func WithLogger added in v0.4.0

func WithLogger(ctx context.Context, log logr.Logger) context.Context

WithLogger returns a copy of the context with the given logger

func WithUser added in v0.4.0

func WithUser(ctx context.Context, val auth.User) context.Context

WithUser adds the User to the context

Types

type IDKey

type IDKey struct{}

IDKey is the unique key to lookup the request ID from the request's context

type LoggerKey added in v0.4.0

type LoggerKey struct{}

LoggerKey is the unique key to lookup the logger from the request's context

type UserKey

type UserKey struct{}

UserKey is the unique key to lookup the username from the request's context

Jump to

Keyboard shortcuts

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