Documentation ¶
Overview ¶
Package muxContext defines a simple context that can be used with HTTP requests to easily store multiple pieces of information within the same http.Request context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EMuxContext ¶
type EMuxContext struct {
// contains filtered or unexported fields
}
EMuxContext is a simple map used to organize multiple pieces of information within one http.Request context. It has been written to be concurrency safe under read/write operations using the methods provided.
func IsolateCtx ¶
func IsolateCtx(r *http.Request) (*EMuxContext, error)
IsolateCtx returns a pointer to the EMuxContext which is stored within the context of the given request, and any errors associated with the operation.
If the context does not exist, entityErrors.MuxCtxNotFound is returned. If the context cannot be parsed, entityErrors.MuxCtxCorrupt is returned.
func (*EMuxContext) EmbedCtx ¶
EmbedCtx returns the given request, with its context modified to include the given emc.
func (*EMuxContext) Retrieve ¶
func (emc *EMuxContext) Retrieve(key string) interface{}
Get retrieves the payload stored under the given keyStr in the EMucContext *emc.
func (*EMuxContext) Set ¶
func (emc *EMuxContext) Set(key string, payload interface{}) error
Set stores the given payload in the EMuxContext *emc under the given keyStr.