parent
f16bd09a47
commit
1ca0afbed9
5 changed files with 46 additions and 5 deletions
@ -1 +1,9 @@ |
|||||||
# Synchronous |
# Synchronous |
||||||
|
|
||||||
|
In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. |
||||||
|
|
||||||
|
A synchronous resolver is a type of resolver that runs and completes its execution before returning any value. It directly returns the result of the computation, without waiting for any external event such as a database query or a third-party API call. |
||||||
|
|
||||||
|
Learn more from the following links: |
||||||
|
|
||||||
|
- [Get Started with Synchronous](https://graphql.org/learn/asynchronous/) |
@ -1 +1,9 @@ |
|||||||
# Asynchronous |
# Asynchronous |
||||||
|
|
||||||
|
In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. |
||||||
|
|
||||||
|
An asynchronous resolver is a type of resolver that runs, but instead of returning the final value, it returns a promise that will be resolved with the final value. This allows the resolver to wait for an external event such as a database query or a third-party API call to complete before returning the result. |
||||||
|
|
||||||
|
Learn more from the following links: |
||||||
|
|
||||||
|
- [Get Started with Asynchronous](https://graphql.org/learn/execution/#asynchronous-resolvers) |
@ -1 +1,9 @@ |
|||||||
# Scalar coercion |
# Scalar Coercion |
||||||
|
|
||||||
|
In GraphQL, scalar coercion is the process of converting a value from one type to another, as it flows through the resolvers. This is needed when the input value for a field does not match the expected type, but can still be successfully converted to the correct type. |
||||||
|
|
||||||
|
Scalar coercion can be implemented in the resolvers by using the **GraphQLScalarType** constructor to define a custom scalar type and providing a **coerce** function that can convert the input value to the correct type. |
||||||
|
|
||||||
|
Learn more from the following links: |
||||||
|
|
||||||
|
- [Get started with Scalar coercion](https://graphql.org/learn/execution/#scalar-coercion) |
@ -1 +1,9 @@ |
|||||||
# Lists |
# Lists |
||||||
|
|
||||||
|
In GraphQL, a list is a type that represents an ordered collection of items. Lists can be used as the return type for a field in a query or mutation, and can contain any type of items, including scalars and objects. |
||||||
|
|
||||||
|
The resolver function for a list field can retrieve the data from a database or a third-party API and return it as an array. |
||||||
|
|
||||||
|
Learn more from the following links: |
||||||
|
|
||||||
|
- [Get started with Lists and Non-Null](https://graphql.org/learn/schema/#lists-and-non-null) |
@ -1 +1,10 @@ |
|||||||
# Resolvers |
# Resolvers |
||||||
|
|
||||||
|
In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. |
||||||
|
|
||||||
|
Each field in a GraphQL schema has a corresponding resolver function that is responsible for returning the data for that field. The resolver function can retrieve the data from a database, a third-party API, or any other source, and return it to the client. |
||||||
|
|
||||||
|
Learn more from the following links: |
||||||
|
|
||||||
|
- [Complete guide to Resolver](https://www.apollographql.com/docs/apollo-server/data/resolvers/) |
||||||
|
- [Tutorial - Resolvers](https://www.tutorialspoint.com/graphql/graphql_resolver.htm) |
Loading…
Reference in new issue