reqctx

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

README

reqctx

reqctx is a utility package designed to manage request-specific context values in this project. It helps to encapsulate authentication status and user information within the Echo request context in a type-safe manner.

Purpose

When developing web applications, it is common to pass values such as authentication status and user information through the request lifecycle. Using Echo's built-in context (echo.Context) can lead to potential issues such as typographical errors, lack of type safety, and reduced code readability.

reqctx addresses these issues by providing a structured way to manage these context values.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCtx

func SetCtx(c echo.Context, ctx Ctx)

SetCtx inserts values into the Echo request context.

Types

type Ctx

type Ctx struct {
	IsHTMXBoosted bool
	IsAuthed      bool
	SessionID     uuid.UUID
	User          dbgen.User
}

Ctx represents the values passed through a single request context.

func GetCtx

func GetCtx(c echo.Context) Ctx

GetCtx retrieves values from the Echo request context.

Jump to

Keyboard shortcuts

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