Compare commits

...

2 Commits

Author SHA1 Message Date
3b30bb049e v0.0.214 reassign innerctx 2023-07-27 09:58:10 +02:00
f0c5b36ea9 v0.0.213 inject gin key value pairs into context 2023-07-27 09:46:06 +02:00
2 changed files with 9 additions and 2 deletions

View File

@@ -14,6 +14,9 @@ type AppContext struct {
}
func CreateAppContext(g *gin.Context, innerCtx context.Context, cancelFn context.CancelFunc) *AppContext {
for key, value := range g.Keys {
innerCtx = context.WithValue(innerCtx, key, value)
}
return &AppContext{
inner: innerCtx,
cancelFunc: cancelFn,
@@ -38,6 +41,10 @@ func (ac *AppContext) Value(key any) any {
return ac.inner.Value(key)
}
func (ac *AppContext) Set(key, value any) {
ac.inner = context.WithValue(ac.inner, key, value)
}
func (ac *AppContext) Cancel() {
ac.cancelled = true
ac.cancelFunc()

View File

@@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.212"
const GoextVersion = "0.0.214"
const GoextVersionTimestamp = "2023-07-26T10:44:26+0200"
const GoextVersionTimestamp = "2023-07-27T09:58:10+0200"