MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / bindFunc

Function bindFunc

src/function/table/show_macros.cpp:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static std::unique_ptr<TableFuncBindData> bindFunc(const main::ClientContext* context,
49 const TableFuncBindInput* input) {
50 std::vector<std::string> columnNames;
51 std::vector<LogicalType> columnTypes;
52 columnNames.emplace_back("name");
53 columnTypes.emplace_back(LogicalType::STRING());
54 columnNames.emplace_back("definition");
55 columnTypes.emplace_back(LogicalType::STRING());
56 std::vector<MacroInfo> macroInfos;
57 auto transaction = transaction::Transaction::Get(*context);
58 auto catalog = Catalog::Get(*context);
59 for (auto& entry : catalog->getMacroEntries(transaction)) {
60 std::string name = entry->getName();
61 auto macroFunction = catalog->getScalarMacroFunction(transaction, name);
62 macroInfos.emplace_back(name, macroFunction->toCypher(name));
63 }
64 columnNames = TableFunction::extractYieldVariables(columnNames, input->yieldVariables);
65 auto columns = input->binder->createVariables(columnNames, columnTypes);
66 return std::make_unique<ShowMacrosBindData>(std::move(macroInfos), std::move(columns),
67 macroInfos.size());
68}
69
70function_set ShowMacrosFunction::getFunctionSet() {
71 function_set functionSet;

Callers

nothing calls this directly

Calls 7

emplace_backMethod · 0.80
getMacroEntriesMethod · 0.80
createVariablesMethod · 0.80
getNameMethod · 0.45
toCypherMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected