MCPcopy Create free account
hub / github.com/gorilla/context / GetOk

Function GetOk

context.go:39–48  ·  view source on GitHub ↗

GetOk returns stored value and presence state like multi-value return of map access.

(r *http.Request, key interface{})

Source from the content-addressed store, hash-verified

37
38// GetOk returns stored value and presence state like multi-value return of map access.
39func GetOk(r *http.Request, key interface{}) (interface{}, bool) {
40 mutex.RLock()
41 if _, ok := data[r]; ok {
42 value, ok := data[r][key]
43 mutex.RUnlock()
44 return value, ok
45 }
46 mutex.RUnlock()
47 return nil, false
48}
49
50// GetAll returns all stored values for the request as a map. Nil is returned for invalid requests.
51func GetAll(r *http.Request) map[interface{}]interface{} {

Callers 1

TestContextFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestContextFunction · 0.68