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

51 lines
1.6 KiB
C#
Raw Normal View History

using MesETL.App.HostedServices;
2024-01-12 16:50:37 +08:00
namespace MesETL.App.Options;
2023-12-29 16:16:05 +08:00
public enum ColumnType
{
Blob,
Text,
2024-01-18 14:36:36 +08:00
Json,
2023-12-29 16:16:05 +08:00
UnDefine,
}
2023-12-28 15:18:03 +08:00
public class DataTransformOptions
{
2024-01-29 09:29:16 +08:00
public bool StrictMode { get; set; } = true;
public bool EnableFilter { get; set; } = true;
public bool EnableReplacer { get; set; } = true;
public bool EnableReBuilder { get; set; } = true;
2024-02-01 13:41:59 +08:00
/// <summary>
/// yyyyMM
/// </summary>
2024-12-10 14:03:09 +08:00
public string CleanDate { get; set; } = "202401";
2024-02-01 13:41:59 +08:00
2024-01-29 09:29:16 +08:00
/// <summary>
/// Record -> Database name
2024-12-10 14:03:09 +08:00
/// 决定记录应当被插入到哪一个数据库中
2024-01-29 09:29:16 +08:00
/// </summary>
2023-12-29 16:16:05 +08:00
public Func<DataRecord, string>? DatabaseFilter { get; set; }
2024-01-04 09:00:44 +08:00
/// <summary>
2024-01-29 09:29:16 +08:00
/// Context -> Should output
2024-12-10 14:03:09 +08:00
/// 对记录进行过滤返回false则不输出
2024-01-04 09:00:44 +08:00
/// </summary>
2024-01-29 09:29:16 +08:00
public Func<DataTransformContext, Task<bool>>? RecordFilter { get; set; }//数据过滤方法
/// <summary>
/// Context -> New record
2024-12-10 14:03:09 +08:00
/// 对当前记录进行修改或完整替换,你可以在这里修改记录中的字段,或者新增/删除字段
2024-01-29 09:29:16 +08:00
/// </summary>
public Func<DataTransformContext, Task<DataRecord>>? RecordModify { get; set; }//数据替换
/// <summary>
/// Context -> New rebuild records
2024-12-10 14:03:09 +08:00
/// 基于当前记录新增多个记录
2024-01-29 09:29:16 +08:00
/// </summary>
public Func<DataTransformContext, IList<DataRecord>?>? RecordReBuild { get; set; }//新增数据
/// <summary>
/// Context -> void
/// 对数据的某些字段进行缓存
/// </summary>
public Func<DataTransformContext, Task>? RecordCache { get; set; }//数据缓存
}