Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
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.
Click to show internal directories.
Click to hide internal directories.