6
GitHub - AmirSoleimani/ctxecho: Inspect your context.Context values.
source link: https://github.com/AmirSoleimani/ctxecho
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Ctx Echo
Returns a map of all key-values stored inside a context. It only works with context.Context
package.
Installation
Using go get:
go get github.com/AmirSoleimani/[email protected]
Usage
It's very easy to use this pkg, You only need to call Inspect
function.
import (
// ...
"github.com/AmirSoleimani/ctxecho"
// ...
)
func MyServiceHandler(ctx context.Context) error {
kvMap := ctxecho.Inspect(ctx)
fmt.Printf("%+v\n", kvMap)
// ...
return nil
}
License
This code is licensed under the MIT license.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK