Mule 4 DataWeave 传递数组到 Db::createStruct
Mule 4 DataWeave Pass array to Db::createStruct
这是我的负载:
[
[
2452,
1,
"AA",
"SH289122275",
"82310",
"CB",
"83.5"
],
[
3456,
2,
"BB ",
"SH389122275",
"92310",
"BB",
"83.5"
]
]
如何使我的有效负载动态适应以下转换(即 [111,"aaa"],[222,"bbb"]),我可能会在我的有效负载中获得更多对象。
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",[
Db::createStruct("Database_Config","DEMO_OBJECT",[111,"aaa"]),
Db::createStruct("Database_Config","DEMO_OBJECT",[222,"bbb"])
])
}
取决于输入数据的结构和顺序。这是一个可能的示例,您可以根据自己的特定需求进行调整:
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",
payload map
Db::createStruct("Database_Config","DEMO_OBJECT",[ $[0], $[1] ... ]))
}
这是我的负载:
[
[
2452,
1,
"AA",
"SH289122275",
"82310",
"CB",
"83.5"
],
[
3456,
2,
"BB ",
"SH389122275",
"92310",
"BB",
"83.5"
]
]
如何使我的有效负载动态适应以下转换(即 [111,"aaa"],[222,"bbb"]),我可能会在我的有效负载中获得更多对象。
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",[
Db::createStruct("Database_Config","DEMO_OBJECT",[111,"aaa"]),
Db::createStruct("Database_Config","DEMO_OBJECT",[222,"bbb"])
])
}
取决于输入数据的结构和顺序。这是一个可能的示例,您可以根据自己的特定需求进行调整:
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",
payload map
Db::createStruct("Database_Config","DEMO_OBJECT",[ $[0], $[1] ... ]))
}