blob: b77585012c407c24efdb1af49b075505ec6a61e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package api
import (
"context"
"errors"
"github.com/labstack/echo/v4"
)
type echoContextKey struct{}
var errNoEchoContext = errors.New("echo context not found")
func getEchoContext(ctx context.Context) echo.Context {
echoCtx, _ := ctx.Value(echoContextKey{}).(echo.Context)
return echoCtx
}
func WithEchoContext(ctx context.Context, echoCtx echo.Context) context.Context {
return context.WithValue(ctx, echoContextKey{}, echoCtx)
}
|