v0.0.213 inject gin key value pairs into context
This commit is contained in:
parent
647ec64c3b
commit
f0c5b36ea9
@ -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 {
|
||||
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) {
|
||||
context.WithValue(ac.inner, key, value)
|
||||
}
|
||||
|
||||
func (ac *AppContext) Cancel() {
|
||||
ac.cancelled = true
|
||||
ac.cancelFunc()
|
||||
|
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.212"
|
||||
const GoextVersion = "0.0.213"
|
||||
|
||||
const GoextVersionTimestamp = "2023-07-26T10:44:26+0200"
|
||||
const GoextVersionTimestamp = "2023-07-27T09:46:06+0200"
|
||||
|
Loading…
Reference in New Issue
Block a user