mirror of
https://github.com/graphql-python/graphene.git
synced 2025-03-30 06:54:15 +03:00
Update dataloader.rst
This commit is contained in:
parent
a5fbb2e9e5
commit
3ed8273239
|
@ -28,10 +28,9 @@ Create loaders by providing a batch loading function.
|
||||||
A batch loading function accepts a list of keys, and returns a ``Promise``
|
A batch loading function accepts a list of keys, and returns a ``Promise``
|
||||||
which resolves to a list of ``values``.
|
which resolves to a list of ``values``.
|
||||||
|
|
||||||
Then load individual values from the loader. ``DataLoader`` will coalesce all
|
``DataLoader`` will coalesce all individual loads which occur within a
|
||||||
individual loads which occur within a single frame of execution (executed once
|
single frame of execution (executed once the wrapping promise is resolved)
|
||||||
the wrapping promise is resolved) and then call your batch function with all
|
and then call your batch function with all requested keys.
|
||||||
requested keys.
|
|
||||||
|
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
@ -96,7 +95,7 @@ Consider the following GraphQL request:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Naively, if ``me``, ``bestFriend`` and ``friends`` each need to request the backend,
|
If ``me``, ``bestFriend`` and ``friends`` each need to send a request to the backend,
|
||||||
there could be at most 13 database requests!
|
there could be at most 13 database requests!
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user