setvalue

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware[V any](key string, value *V) func(ctx *velaros.Context)

Middleware creates middleware that sets a dereferenced pointer value on the message-level context. The pointer is dereferenced when the middleware is created, so updates to the pointed-to value after middleware creation won't be reflected. Values set at the message level only exist for the duration of that message's handler chain.

Use this when you have a pointer to a value that you want to store by value.

Example:

config := &AppConfig{MaxRetries: 3}
router.Use(setvalue.Middleware("config", config))  // Stores *config (dereferenced)

router.Bind("/process", func(ctx *velaros.Context) {
    cfg := ctx.MustGet("config").(AppConfig)  // Gets the value, not pointer
    // ...
})

See also: set.Middleware for direct values, setfn.Middleware for dynamic values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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