contextx

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyRequest contextKey = iota
	KeyRequestID
	KeyRequestIP
	KeyPrincipal
	KeyLogger
	KeyDB
	KeyDataPermApplier
	KeyRequestMethod
	KeyRequestPath
)

Variables

This section is empty.

Functions

func DB

func DB(ctx context.Context, fallbacks ...orm.DB) orm.DB

func Logger

func Logger(ctx context.Context, fallbacks ...logx.Logger) logx.Logger

func Principal

func Principal(ctx context.Context) *security.Principal

func RequestID

func RequestID(ctx context.Context) string

func RequestIP

func RequestIP(ctx context.Context) string

func RequestMethod added in v0.28.0

func RequestMethod(ctx context.Context) string

RequestMethod returns the HTTP method of the current request, if the auth middleware recorded it. Used by signature auth to bind the method.

func RequestPath added in v0.28.0

func RequestPath(ctx context.Context) string

RequestPath returns the request path of the current request, if the auth middleware recorded it. Used by signature auth to bind the path.

func SetDB

func SetDB(ctx context.Context, db orm.DB) context.Context

func SetDataPermApplier

func SetDataPermApplier(ctx context.Context, applier security.DataPermissionApplier) context.Context

func SetLogger

func SetLogger(ctx context.Context, logger logx.Logger) context.Context

func SetPrincipal

func SetPrincipal(ctx context.Context, principal *security.Principal) context.Context

func SetRequestID

func SetRequestID(ctx context.Context, requestID string) context.Context

func SetRequestIP

func SetRequestIP(ctx context.Context, ip string) context.Context

func SetRequestMethod added in v0.28.0

func SetRequestMethod(ctx context.Context, method string) context.Context

func SetRequestPath added in v0.28.0

func SetRequestPath(ctx context.Context, path string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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