MCPcopy Create free account
hub / github.com/golang/appengine / Namespace

Function Namespace

namespace.go:16–21  ·  view source on GitHub ↗

Namespace returns a replacement context that operates within the given namespace.

(c context.Context, namespace string)

Source from the content-addressed store, hash-verified

14
15// Namespace returns a replacement context that operates within the given namespace.
16func Namespace(c context.Context, namespace string) (context.Context, error) {
17 if !validNamespace.MatchString(namespace) {
18 return nil, fmt.Errorf("appengine: namespace %q does not match /%s/", namespace, validNamespace)
19 }
20 return internal.NamespacedContext(c, namespace), nil
21}
22
23// validNamespace matches valid namespace names.
24var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`)

Callers 5

TestNamespaceResettingFunction · 0.92
TestNamespaceResettingFunction · 0.92
TestNamespaceResettingFunction · 0.92
StatFunction · 0.92
TestNamespaceValidityFunction · 0.70

Calls 1

NamespacedContextFunction · 0.92

Tested by 4

TestNamespaceResettingFunction · 0.74
TestNamespaceResettingFunction · 0.74
TestNamespaceResettingFunction · 0.74
TestNamespaceValidityFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…