Skip to content

Commit

Permalink
add todo
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Oct 24, 2024
1 parent ccd34f3 commit ca51aef
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Rdmp.Core/DataLoad/Modules/Mutilators/RegexRedactionMutilator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ private bool ColumnMatches(DiscoveredColumn column)
if (ColumnRegexPattern != null)
{
ColumnRegexPattern = new Regex(ColumnRegexPattern.ToString(), RegexOptions.IgnoreCase);
var x = column.GetRuntimeName();
if (ColumnRegexPattern.IsMatch(column.GetRuntimeName()))
{
Console.WriteLine("X");
}
return ColumnRegexPattern.IsMatch(column.GetRuntimeName());
}
else if (OnlyColumns is not null && OnlyColumns.Length > 0)
Expand Down Expand Up @@ -75,7 +70,23 @@ protected override void MutilateTable(IDataLoadJob job, ITableInfo tableInfo, Di
return;
}
var pkColumnInfos = cataloguePks.Select(c => c.ColumnInfo);
foreach (var column in columns.Where(c => !pkColumnInfos.Select(c => c.GetRuntimeName()).Contains(c.GetRuntimeName())))
//if you would match a pk
var matchedOnPk = false;
foreach (var column in columns.Where(c => pkColumnInfos.Select(c => c.GetRuntimeName()).Contains(c.GetRuntimeName())))
{
if (ColumnMatches(column))
{
matchedOnPk = true;
job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, $"Would masath on column '{column.GetRuntimeName()}' but it is a primary key"));
}
}

var nonPKColumns = columns.Where(c => !pkColumnInfos.Select(c => c.GetRuntimeName()).Contains(c.GetRuntimeName()));
if(!nonPKColumns.Any() && matchedOnPk)
{
//TOOD warn the user that they're doing nothing, but we would have hit a PK, maybe error?
}
foreach (var column in nonPKColumns)
{
if (ColumnMatches(column))
{
Expand Down

0 comments on commit ca51aef

Please sign in to comment.