( conditions: TableLevelCondition[] )
| 573 | }; |
| 574 | |
| 575 | const mergeTableLevelConditions = ( |
| 576 | conditions: TableLevelCondition[] |
| 577 | ): TableLevelCondition[] => { |
| 578 | const groupedConditions: Record<string, string[]> = {}; |
| 579 | |
| 580 | for (const condition of conditions) { |
| 581 | const { database, schema, table } = condition; |
| 582 | const key = `${database}:${schema}`; |
| 583 | |
| 584 | if (groupedConditions[key]) { |
| 585 | groupedConditions[key] = [...groupedConditions[key], ...table]; |
| 586 | } else { |
| 587 | groupedConditions[key] = [...table]; |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | const mergedConditions: TableLevelCondition[] = []; |
| 592 | |
| 593 | for (const key of Object.keys(groupedConditions)) { |
| 594 | const [database, schema] = key.split(":"); |
| 595 | const condition: TableLevelCondition = { |
| 596 | database, |
| 597 | schema, |
| 598 | table: groupedConditions[key], |
| 599 | }; |
| 600 | mergedConditions.push(condition); |
| 601 | } |
| 602 | |
| 603 | return mergedConditions; |
| 604 | }; |
| 605 | |
| 606 | const mergeColumnLevelConditions = ( |
| 607 | conditions: ColumnLevelCondition[] |
no test coverage detected