MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / make_join

Function make_join

extensions/expression-language/Expression.cpp:1368–1399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366}
1367
1368Expression make_join(const std::string &function_name, const std::vector<Expression> &args) {
1369 if (args.size() != 2) {
1370 std::stringstream message_ss;
1371 message_ss << "Expression language function " << function_name << " called with " << args.size() << " argument(s), but " << 2 << " are required";
1372 throw std::runtime_error(message_ss.str());
1373 }
1374
1375 if (!args[0].is_multi()) {
1376 std::stringstream message_ss;
1377 message_ss << "Expression language function " << function_name << " called against singular expression.";
1378 throw std::runtime_error(message_ss.str());
1379 }
1380
1381 auto delim_expr = args[1];
1382
1383 return args[0].make_aggregate([delim_expr](const Parameters &params,
1384 const std::vector<Expression> &sub_exprs) -> Value {
1385 std::string delim = delim_expr(params).asString();
1386 std::stringstream out_ss;
1387 bool first = true;
1388
1389 for (const auto &sub_expr : sub_exprs) {
1390 if (!first) {
1391 out_ss << delim;
1392 }
1393 out_ss << sub_expr(params).asString();
1394 first = false;
1395 }
1396
1397 return Value(out_ss.str());
1398 });
1399}
1400
1401Expression make_dynamic_function(const std::string &function_name, const std::vector<Expression> &args) {
1402 if (function_name == "hostname") {

Callers 1

make_dynamic_functionFunction · 0.85

Calls 5

is_multiMethod · 0.80
make_aggregateMethod · 0.80
asStringMethod · 0.80
ValueClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected