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

Method RewriteQueries

graphql/resolve/mutation.go:96–96  ·  view source on GitHub ↗

RewriteQueries generates and rewrites GraphQL mutation m into DQL queries which check if any referenced node by XID or ID exist or not. Instead of filtering on dgraph.type like @filter(type(Parrot)), we query `dgraph.type` and filter it on GraphQL side. @filter(type(Parrot)) is costly in terms of me

(ctx context.Context, m schema.Mutation)

Source from the content-addressed store, hash-verified

94 // These query will be created in case of Add or Update Mutation which references node
95 // 0x127 or Computer of name "computer1"
96 RewriteQueries(ctx context.Context, m schema.Mutation) ([]*dql.GraphQuery, []string, error)
97 // Rewrite rewrites GraphQL mutation m into a Dgraph mutation - that could
98 // be as simple as a single DelNquads, or could be a Dgraph upsert mutation
99 // with a query and multiple mutations guarded by conditions.

Callers 7

deleteMutationRewritingFunction · 0.65
mutationRewritingFunction · 0.65
mutationQueryRewritingFunction · 0.65
deleteQueryRewritingFunction · 0.65
rewriteAndExecuteMethod · 0.65
RewriteQueriesMethod · 0.65

Implementers 3

AddRewritergraphql/resolve/mutation_rewriter.go
UpdateRewritergraphql/resolve/mutation_rewriter.go
deleteRewritergraphql/resolve/mutation_rewriter.go

Calls

no outgoing calls

Tested by 5

deleteMutationRewritingFunction · 0.52
mutationRewritingFunction · 0.52
mutationQueryRewritingFunction · 0.52
deleteQueryRewritingFunction · 0.52