Skip to content

Commit

Permalink
update extensions doc
Browse files Browse the repository at this point in the history
  • Loading branch information
m.kindritskiy committed Dec 7, 2023
1 parent 03ceb4d commit 930cd8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog/changes_07.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ Changes in 0.7
- Added support for enums :ref:`Check enums documentation <enums-doc>`
- Added support for custom scalars :ref:`Check custom scalars documentation <scalars-doc>`
- Added support for extensions :ref:`Check extensions documentation <extensions-doc>`

- Added ``QueryParseCache`` extension - cache parsed graphql queries ast.
- Added ``QueryTransformCache`` extension - cache transformed graphql ast into query Node.
- Added ``QueryValidationCache`` extension - cache query validation.
- Added ``QueryDepthValidator`` extension - validate query depth
- Added ``PrometheusMetrics`` extension - wrapper around ``GraphMetrics`` visitor
- Added ``PrometheusMetricsAsync`` extension - wrapper around ``AsyncGraphMetrics`` visitor

- Add new method ``Engine.execute_context``, which accepts ``ExecutionContext``. ``Engine.execute`` now dispatches to ``Engine.execute_context``.
- Add new method ``Engine.execute_mutation``, which allows to execute query against mutation graph
- Add optional ``context`` argument to ``GraphqlEndpoint.dispatch`` method
Expand Down
7 changes: 5 additions & 2 deletions docs/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ Writing extension

.. code-block:: python
from hiku.extensions import Extension
from typing import Iterator
from hiku.extensions.base_extension import Extension
from hiku.context import ExecutionContext
class TimeItExtension(Extension):
def on_execute(self):
def on_execute(self, execution_context: ExecutionContext) -> Iterator[None]:
start = time.perf_counter()
yield
print('Query execution took {:.3f} seconds'.format(time.perf_counter() - start))
Expand Down

0 comments on commit 930cd8c

Please sign in to comment.