MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / validateKeys

Function validateKeys

edgraph/server.go:2370–2383  ·  view source on GitHub ↗

validateKeys checks predicate and facet keys in N-Quad for syntax errors.

(nq *api.NQuad)

Source from the content-addressed store, hash-verified

2368
2369// validateKeys checks predicate and facet keys in N-Quad for syntax errors.
2370func validateKeys(nq *api.NQuad) error {
2371 if err := validateKey(nq.Predicate); err != nil {
2372 return errors.Wrapf(err, "predicate %q", nq.Predicate)
2373 }
2374 for i := range nq.Facets {
2375 if nq.Facets[i] == nil {
2376 continue
2377 }
2378 if err := validateKey(nq.Facets[i].Key); err != nil {
2379 return errors.Errorf("Facet %q, %s", nq.Facets[i].Key, err)
2380 }
2381 }
2382 return nil
2383}
2384
2385// validateQuery verifies that the query does not contain any preds that
2386// are longer than the limit (2^16).

Callers 2

validateNQuadsFunction · 0.85
TestValidateKeysFunction · 0.85

Calls 2

validateKeyFunction · 0.85
ErrorfMethod · 0.45

Tested by 1

TestValidateKeysFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…