request

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 2 Imported by: 0

README

Request

This package provides internal context management utilities for HTTP requests. It is primarily used by other packages in the framework and not intended for direct use.

Components

Context Keys

Defines type-safe context keys:

  • SessionCtxKey - For user session data
  • RequestIdCtxKey - For request ID tracking
RequestIdCtx

Manages request ID in context:

type RequestIdCtx struct {
    RequestId string
}
SessionCtx

Manages user session data in context:

type SessionCtx struct {
    Id       string
    Name     string
    Email    string
    Username string
}

Usage

This package is used internally by:

  • middleware package for request ID and authentication
  • logging packages for context extraction
  • Other framework components that need request context data

For typical application development, use the middleware package instead of accessing these utilities directly.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithRequestIdCtx added in v0.18.0

func WithRequestIdCtx(ctx context.Context, requestId string) context.Context

Types

type CtxKey

type CtxKey string
const (
	SessionCtxKey   CtxKey = CtxKey("sessionCtx")
	RequestIdCtxKey CtxKey = CtxKey("requestIdCtx")
)

type RequestIdCtx

type RequestIdCtx struct {
	RequestId string
}

func NewRequestIdCtx

func NewRequestIdCtx(requestId string) *RequestIdCtx

type SessionCtx

type SessionCtx struct {
	Id       string
	Name     string
	Email    string
	Username string
}

func NewSessionCtx

func NewSessionCtx(id, name, email, username string) *SessionCtx

func (*SessionCtx) SetSessionCtx added in v0.18.0

func (s *SessionCtx) SetSessionCtx(user auth.AuthUser)

Jump to

Keyboard shortcuts

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