Skip to content

cogger/stash

Repository files navigation

stash

GoDoc
Build Status
Coverage Status
License

stash adds generic data to contexts

Installation

The import path for the package is gopkg.in/cogger/stash.v1.

To install it, run:

go get gopkg.in/cogger/stash.v1

Usage

// main.go
package main

import (
	"gopkg.in/cogger/stash"
	"golang.org/x/net/context"
)

func main() {
	ctx := stash.Set(context.Background(),"something","somethingelse")
	ctx = stash.Set(ctx,"anotherKey",132.2)

	value, ok := stash.Get(ctx,"something").(string)
}