2025迁移版本,多项规则修改
This commit is contained in:
@@ -1,29 +1,66 @@
|
||||
namespace MesETL.App.Options;
|
||||
using MesETL.App.HostedServices;
|
||||
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public class DatabaseOutputOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 输出数据库的连接字符串
|
||||
/// </summary>
|
||||
public string? ConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MySql max_allowed_packet变量值大小
|
||||
/// </summary>
|
||||
public int MaxAllowedPacket { get; set; } = 32 * 1024 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// 每次Insert提交的数据量
|
||||
/// </summary>
|
||||
public int FlushCount { get; set; } = 10000;
|
||||
|
||||
/// <summary>
|
||||
/// 每个数据库最大提交任务数
|
||||
/// </summary>
|
||||
public int MaxDatabaseOutputTask { get; set; } = 4;
|
||||
|
||||
/// <summary>
|
||||
/// 将json列作为16进制格式输出(0x前缀)
|
||||
/// </summary>
|
||||
public bool TreatJsonAsHex { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 不对某些表进行输出
|
||||
/// </summary>
|
||||
public string[] NoOutput { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// <para>当某张表的键出现重复时,在输出时使用ON DUPLICATE KEY UPDATE更新该条记录</para>
|
||||
/// <para>表名为键,更新的字段为值</para>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// {
|
||||
/// // 当order_data_parts表的键出现重复时,使用ON DUPLICATE KEY UPDATE更新已存在记录的CompanyID为新插入记录的值
|
||||
/// "order_data_parts": "CompanyID = new.CompanyID"
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </summary>
|
||||
public Dictionary<string, string>? ForUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置导入数据的特殊列
|
||||
/// 配置导入数据的特殊列,请在代码中配置
|
||||
/// </summary>
|
||||
public Dictionary<string, ColumnType> ColumnTypeConfig { get; set; } = new(); // "table.column" -> type
|
||||
|
||||
/// <summary>
|
||||
/// 所有数据都输出完毕时的事件,请在代码中配置
|
||||
/// </summary>
|
||||
public Action<DataOutputContext>? OutputFinished { get; set; }
|
||||
|
||||
public ColumnType GetColumnType(string table, string column)
|
||||
{
|
||||
return ColumnTypeConfig.GetValueOrDefault($"{table}.{column}", ColumnType.UnDefine);
|
||||
return ColumnTypeConfig.GetValueOrDefault(string.Concat(table, ".", column), ColumnType.UnDefine);
|
||||
}
|
||||
|
||||
public bool TryGetForUpdate(string table, out string? forUpdate)
|
||||
|
Reference in New Issue
Block a user