diff options
| author | Michael Williamson <mike@zwobble.org> | 2020-10-11 11:54:37 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2020-10-11 11:57:34 +0100 |
| commit | 14393f779c2c9e2e0c99863b193738ba29a6660a (patch) | |
| tree | 4ea399a48c4dc3821526544e5b3c5b34a5e2460a /README.rst | |
| parent | 54467df8c6f06c2d4421ab5d0446d7cd8f5040e1 (diff) | |
Add support for predefined variables
Diffstat (limited to 'README.rst')
| -rw-r--r-- | README.rst | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -106,6 +106,13 @@ Call ``iter()`` to get all of the output elements as an iterator: assert next(iterator, None) == 4 assert next(iterator, None) == None +Calling ``compile()`` with the ``args`` argument allows predefined variables to be used within the program: + +.. code-block:: python + + program = jq.compile("$a + $b + .", args={"a": 100, "b": 20}) + assert program.input(3).first() == 123 + Convenience functions are available to get the output for a program and input in one call: .. code-block:: python |
