* Insert multiple edges in a transaction
(edges: Edge[])
| 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 |
no test coverage detected