Generally, all functions in all docs should be documented with their input paramters, parameter types, and return type to be complete, but lambda functions do not include types. Also it appears the functions vary based on how they are added (via addGraphQLResolvers() or dql version, etc.).
with a note that
" Note A Lambda Query resolver can use a combination of parents, args, dql, or graphql inside the function. "
but the type, structure and use of parents, args, dql, and graphql are not defined. From the code, it seems dql is a thing that has a query function (dql.query(...)) but it's unclear what it is, and if the key to using them is to use these particular variable names in the functions.
Generally, all functions in all docs should be documented with their input paramters, parameter types, and return type to be complete, but lambda functions do not include types. Also it appears the functions vary based on how they are added (via addGraphQLResolvers() or dql version, etc.).
This is in v22.0 docs.
https://dgraph.io/docs/graphql/lambda/mutation docs describe javascript functions with signature:
async function authorsByName({args, dql})
with a note that " Note A Lambda Query resolver can use a combination of parents, args, dql, or graphql inside the function. "
but the type, structure and use of parents, args, dql, and graphql are not defined. From the code, it seems dql is a thing that has a query function (
dql.query(...)
) but it's unclear what it is, and if the key to using them is to use these particular variable names in the functions.Similarly https://dgraph.io/docs/graphql/lambda/query/ uses graphql, which appears to be a simple function.
const results = await graphql('mutation ($name: String!)
Similar for use of
parents
in https://dgraph.io/docs/graphql/lambda/field/