MCPcopy
hub / github.com/dgraph-io/dgraph / filterSchemaNodeForNamespace

Function filterSchemaNodeForNamespace

query/query.go:3111–3123  ·  view source on GitHub ↗

filterSchemaNodeForNamespace filters schema nodes for the given namespace.

(namespace uint64, nodes []*pb.SchemaNode)

Source from the content-addressed store, hash-verified

3109
3110// filterSchemaNodeForNamespace filters schema nodes for the given namespace.
3111func filterSchemaNodeForNamespace(namespace uint64, nodes []*pb.SchemaNode) []*pb.SchemaNode {
3112 out := []*pb.SchemaNode{}
3113
3114 for _, node := range nodes {
3115 nodeNamespace, attrName := x.ParseNamespaceAttr(node.Predicate)
3116 if nodeNamespace != namespace {
3117 continue
3118 }
3119 node.Predicate = attrName
3120 out = append(out, node)
3121 }
3122 return out
3123}
3124
3125// StripBlankNode returns a copy of the map where all the keys have the blank node prefix removed.
3126func StripBlankNode(mp map[string]uint64) map[string]uint64 {

Callers 1

ProcessMethod · 0.85

Calls 1

ParseNamespaceAttrFunction · 0.92

Tested by

no test coverage detected