MCPcopy
hub / github.com/colbymchenry/codegraph / insertEdges

Method insertEdges

src/db/queries.ts:1280–1298  ·  view source on GitHub ↗

* Insert multiple edges in a transaction

(edges: Edge[])

Source from the content-addressed store, hash-verified

1278 * Insert multiple edges in a transaction
1279 */
1280 insertEdges(edges: Edge[]): void {
1281 if (edges.length === 0) return;
1282
1283 this.db.transaction(() => {
1284 const endpointIds = new Set<string>();
1285 for (const edge of edges) {
1286 endpointIds.add(edge.source);
1287 endpointIds.add(edge.target);
1288 }
1289 const existingNodeIds = this.getExistingNodeIds([...endpointIds]);
1290
1291 for (const edge of edges) {
1292 if (!existingNodeIds.has(edge.source) || !existingNodeIds.has(edge.target)) {
1293 continue;
1294 }
1295 this.insertEdge(edge);
1296 }
1297 })();
1298 }
1299
1300 /**
1301 * Delete all edges from a source node

Calls 4

getExistingNodeIdsMethod · 0.95
insertEdgeMethod · 0.95
hasMethod · 0.80
transactionMethod · 0.65

Tested by

no test coverage detected