MES-ETL/MesETL.App/Options/DatabaseOutputOptions.cs

36 lines
1.0 KiB
C#
Raw Normal View History

namespace MesETL.App.Options;
2024-01-04 09:00:44 +08:00
public class DatabaseOutputOptions
{
2024-01-29 09:29:16 +08:00
public string? ConnectionString { get; set; }
2024-02-15 16:18:50 +08:00
public int MaxAllowedPacket { get; set; } = 32 * 1024 * 1024;
2024-01-29 09:29:16 +08:00
public int FlushCount { get; set; } = 10000;
public int MaxDatabaseOutputTask { get; set; } = 4;
public bool TreatJsonAsHex { get; set; } = true;
2024-02-15 16:18:50 +08:00
public string[] NoOutput { get; set; } = [];
2024-01-29 09:29:16 +08:00
2024-02-15 16:18:50 +08:00
public Dictionary<string, string>? ForUpdate { get; set; }
2024-01-29 09:29:16 +08:00
2024-01-04 09:00:44 +08:00
/// <summary>
2024-01-29 09:29:16 +08:00
/// 配置导入数据的特殊列
2024-01-04 09:00:44 +08:00
/// </summary>
2024-01-29 09:29:16 +08:00
public Dictionary<string, ColumnType> ColumnTypeConfig { get; set; } = new(); // "table.column" -> type
public ColumnType GetColumnType(string table, string column)
{
return ColumnTypeConfig.GetValueOrDefault($"{table}.{column}", ColumnType.UnDefine);
}
2024-02-15 16:18:50 +08:00
public bool TryGetForUpdate(string table, out string? forUpdate)
{
forUpdate = null;
if (ForUpdate is null || !ForUpdate.TryGetValue(table, out forUpdate))
return false;
return true;
}
2024-01-04 09:00:44 +08:00
}