MCPcopy Create free account
hub / github.com/araddon/qlbridge / NewNamespacedContextReader

Function NewNamespacedContextReader

datasource/context.go:279–284  ·  view source on GitHub ↗

NewNestedContextReader provides a context reader which prefixes all keys with a name space. This is useful if you have overlapping field names between ContextReaders within a NestedContextReader. msg.Get("foo.key")

(basereader expr.ContextReader, namespace string)

Source from the content-addressed store, hash-verified

277// msg.Get("foo.key")
278//
279func NewNamespacedContextReader(basereader expr.ContextReader, namespace string) expr.ContextReader {
280 if namespace == "" {
281 return basereader
282 }
283 return &NamespacedContextReader{basereader, strings.ToLower(namespace)}
284}
285
286func (n *NamespacedContextReader) Get(key string) (value.Value, bool) {
287 left, right, has := expr.LeftRight(key)

Callers 1

TestNamespacesFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestNamespacesFunction · 0.74