|
|
@ -29,7 +29,7 @@ export const extractPkFromRow = (row: Record<string, any>, columns: ColumnType[] |
|
|
|
const pkCols = columns.filter((c: Required<ColumnType>) => c.pk) |
|
|
|
const pkCols = columns.filter((c: Required<ColumnType>) => c.pk) |
|
|
|
// if multiple pk columns, join them with ___ and escape _ in id values with \_ to avoid conflicts
|
|
|
|
// if multiple pk columns, join them with ___ and escape _ in id values with \_ to avoid conflicts
|
|
|
|
if (pkCols.length > 1) { |
|
|
|
if (pkCols.length > 1) { |
|
|
|
pkCols.map((c: Required<ColumnType>) => row?.[c.title]?.toString?.().replaceAll('_', '\\_') ?? null).join('___') |
|
|
|
return pkCols.map((c: Required<ColumnType>) => row?.[c.title]?.toString?.().replaceAll('_', '\\_') ?? null).join('___') |
|
|
|
} else if (pkCols.length) { |
|
|
|
} else if (pkCols.length) { |
|
|
|
return row?.[pkCols[0].title] ?? null |
|
|
|
return row?.[pkCols[0].title] ?? null |
|
|
|
} |
|
|
|
} |
|
|
|