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

Function bindFunc

src/function/table/show_graphs.cpp:47–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47static std::unique_ptr<TableFuncBindData> bindFunc(const main::ClientContext* context,
48 const TableFuncBindInput* input) {
49 std::vector<std::string> columnNames;
50 std::vector<LogicalType> columnTypes;
51 columnNames.emplace_back("name");
52 columnTypes.emplace_back(LogicalType::STRING());
53 columnNames.emplace_back("type");
54 columnTypes.emplace_back(LogicalType::STRING());
55
56 std::vector<GraphInfo> graphInfos;
57 auto transaction = transaction::Transaction::Get(*context);
58 auto catalog = context->getDatabase()->getCatalog();
59
60 // Get all graphs from the main database catalog
61 auto graphEntries = catalog->getGraphEntries(transaction);
62 for (auto* entry : graphEntries) {
63 std::string graphType = entry->isAnyGraphType() ? "ANY" : "STANDARD";
64 graphInfos.emplace_back(entry->getName(), graphType);
65 }
66
67 columnNames = TableFunction::extractYieldVariables(columnNames, input->yieldVariables);
68 auto columns = input->binder->createVariables(columnNames, columnTypes);
69 return std::make_unique<ShowGraphsBindData>(std::move(graphInfos), std::move(columns),
70 graphInfos.size());
71}
72
73function_set ShowGraphsFunction::getFunctionSet() {
74 function_set functionSet;

Callers

nothing calls this directly

Calls 7

emplace_backMethod · 0.80
getCatalogMethod · 0.80
getGraphEntriesMethod · 0.80
createVariablesMethod · 0.80
getDatabaseMethod · 0.45
getNameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected