这个 mule 函数到底是关于什么的
what is exactly is this mule function is about
我是 Dataweave 的新手,正在玩 function.This 可能是一个非常愚蠢的问题,但我需要做哪些改变才能让它工作?
%dw 2.0
output application/json
fun add(a,b) = {
if (a + b > 10) 1 else 0
}
---
{
flag: add(6,2)
}
我希望标志为 1 或 0
%dw 2.0
output application/json
fun add(a,b) = {
result: if (a + b > 10) 1 else 0
}
---
{
flag: add(6,2)
}
您应该删除 fun 定义中的 {}。在这种情况下,大括号用于创建对象(key:value 对的集合)
%dw 2.0
output application/json
fun add(a,b) = if (a + b > 10) 1 else 0
---
{
flag: add(6,2)
}
我是 Dataweave 的新手,正在玩 function.This 可能是一个非常愚蠢的问题,但我需要做哪些改变才能让它工作?
%dw 2.0
output application/json
fun add(a,b) = {
if (a + b > 10) 1 else 0
}
---
{
flag: add(6,2)
}
我希望标志为 1 或 0
%dw 2.0
output application/json
fun add(a,b) = {
result: if (a + b > 10) 1 else 0
}
---
{
flag: add(6,2)
}
您应该删除 fun 定义中的 {}。在这种情况下,大括号用于创建对象(key:value 对的集合)
%dw 2.0
output application/json
fun add(a,b) = if (a + b > 10) 1 else 0
---
{
flag: add(6,2)
}