worldline-go / contextx

context key/value store

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

contextx

License Coverage GitHub Workflow Status Go Report Card Go PKG

Context value helper library.
Differences between context package this holds value in a map with mutex lock.

go get github.com/worldline-go/contextx

Usage

// set value first initialize context value map if not exist
ctx := contextx.WithValue(context.Background(), "secret", "xxx")

// map like access
if v, ok := contextx.Value[string](ctx, "secret"); ok {
    // v is string
}

About

context key/value store

License:MIT License


Languages

Language:Go 68.8%Language:Makefile 31.2%