context

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Trace uint = 1 << iota // 1 << 0 = 1
	Debug                  // 1 << 1 = 2
)
View Source
const (
	LabelKrateoTraceId = "X-Krateo-TraceId"
)

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(ctx context.Context) (string, bool)

func BuildContext

func BuildContext(ctx context.Context, opts ...WithContextFunc) context.Context

func Logger

func Logger(ctx context.Context) *slog.Logger

func TraceId

func TraceId(ctx context.Context, generate bool) string

func UserConfig

func UserConfig(ctx context.Context) (endpoints.Endpoint, error)

func UserInfo

func UserInfo(ctx context.Context) (jwtutil.UserInfo, error)

Types

type WithContextFunc

type WithContextFunc func(context.Context) context.Context

func WithAccessToken

func WithAccessToken(tok string) WithContextFunc

func WithLogger

func WithLogger(root *slog.Logger) WithContextFunc

func WithTraceId

func WithTraceId(traceId string) WithContextFunc

func WithUserConfig

func WithUserConfig(ep endpoints.Endpoint) WithContextFunc

func WithUserInfo

func WithUserInfo(ui jwtutil.UserInfo) WithContextFunc

Jump to

Keyboard shortcuts

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