-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Greetings and Happy New Year :3!
I have a question!, How can i register and await async functions?.
I tried something like this:
import jsonata
class JsonataFunctions:
class Asum(jsonata.Jsonata.JFunctionCallable):
async def call(self, inputs, args):
result = await (args[0] + args[1])
return result
def test_async_jsonata():
expression_input = {}
expression_str = """ {"test": $aSum(1, 2)}"""
expression = jsonata.Jsonata(expression_str)
expression.register_function(
"aSum", jsonata.Jsonata.JFunction(JsonataFunctions.Asum(), "<nn:n>"))
return expression.evaluate(expression_input)
But every instance of a function in the expression is replaced with a coroutine and never awaited.
In the example:
{'test': <coroutine object JsonataFunctions.Asum.call at 0x117827bc0>}
Maybe im doing something wrong or the library doesn't support it, i hope you can help me!, good work btw :D!
Metadata
Metadata
Assignees
Labels
No labels