This commit is contained in:
2024-01-04 09:00:44 +08:00
parent c53d2927bb
commit eab3695f53
27 changed files with 258 additions and 466 deletions

View File

@@ -3,26 +3,17 @@
public class CsvOptions
{
/// <summary>
/// The directory to input csv and sql file.
/// MyDumper导出的CSV文件目录
/// </summary>
public string InputDir { get; set; } = "./";
/// <summary>
/// The output directory.
/// </summary>
public string OutputDir { get; set; } = "./Output";
/// <summary>
/// The ASCII char that fields are enclosed by. Default is '"'.
/// 字符串的包围符号,默认为双引号"
/// </summary>
public char QuoteChar { get; set; } = '"';
/// <summary>
/// The ASCII char that fields are separated by. Default is ','.
/// 每个字段的分割符,默认逗号,
/// </summary>
public char DelimiterChar { get; set; } = ',';
/// <summary>
/// The max number of threads to use.
/// </summary>
public int MaxThreads { get; set; } = 12;
public string Delimiter { get; set; } = ",";
}

View File

@@ -1,6 +1,4 @@
using ConsoleApp2.Entities;
namespace ConsoleApp2.Options;
namespace ConsoleApp2.Options;
public enum ColumnType
{
@@ -12,6 +10,10 @@ public enum ColumnType
public class DataTransformOptions
{
public Func<DataRecord, string>? DatabaseFilter { get; set; }
/// <summary>
/// 配置导入数据的特殊列
/// </summary>
public Dictionary<string, ColumnType> ColumnTypeConfig { get; set; } = new(); // "table.column" -> type
public ColumnType GetColumnType(string table, string column)

View File

@@ -1,10 +0,0 @@
namespace ConsoleApp2.Options;
public class DatabaseOptions
{
public string Host { get; set; }
public uint Port { get; set; }
public string Database { get; set; }
public string User { get; set; }
public string Password { get; set; }
}

View File

@@ -0,0 +1,17 @@
namespace ConsoleApp2.Options;
public class DatabaseOutputOptions
{
/// <summary>
/// 数据库连接字符串
/// </summary>
public string? ConnectionString { get; set; }
/// <summary>
/// 输出服务的最大任务(Task)数
/// </summary>
public int MaxTask { get; set; }
/// <summary>
/// 每个任务每次提交到数据库的记录数量每N条构建一次SQL语句
/// </summary>
public int FlushCount { get; set; }
}