MCPcopy Create free account
hub / github.com/bytebase/bytebase / mergeTableLevelConditions

Function mergeTableLevelConditions

frontend/src/utils/issue/cel.ts:575–604  ·  view source on GitHub ↗
(
  conditions: TableLevelCondition[]
)

Source from the content-addressed store, hash-verified

573};
574
575const 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
606const mergeColumnLevelConditions = (
607 conditions: ColumnLevelCondition[]

Callers 1

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected