Documentation
¶
Overview ¶
Package gin provides adapters for using err-envelope with Gin framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Trace ¶
func Trace() gin.HandlerFunc
Trace wires err-envelope trace ID middleware into Gin's middleware chain.
This generates or propagates trace IDs and makes them available via errenvelope.TraceIDFromRequest(c.Request).
Example:
r := gin.Default()
r.Use(Trace())
r.GET("/user", func(c *gin.Context) {
traceID := errenvelope.TraceIDFromRequest(c.Request)
// ...
})
func Write ¶
Write sends a structured error response using err-envelope format.
This is a convenience wrapper that extracts c.Writer and c.Request to call errenvelope.Write.
Example:
r.GET("/user", func(c *gin.Context) {
if userID == "" {
Write(c, errenvelope.BadRequest("Missing user ID"))
return
}
// ...
})
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.