feat(datasync): add JsonColumnSchema record for ETL column metadata
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
namespace JdeScoping.DataSync.Etl.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a column schema for JSON-to-DataReader mapping.
|
||||||
|
/// </summary>
|
||||||
|
public record JsonColumnSchema(
|
||||||
|
string Name,
|
||||||
|
Type ClrType,
|
||||||
|
bool IsNullable = true)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the SQL type name for this column (used in error messages).
|
||||||
|
/// </summary>
|
||||||
|
public string SqlTypeName => ClrType switch
|
||||||
|
{
|
||||||
|
Type t when t == typeof(string) => "VARCHAR",
|
||||||
|
Type t when t == typeof(int) => "INT",
|
||||||
|
Type t when t == typeof(long) => "BIGINT",
|
||||||
|
Type t when t == typeof(decimal) => "DECIMAL",
|
||||||
|
Type t when t == typeof(DateTime) => "DATETIME2",
|
||||||
|
Type t when t == typeof(bool) => "BIT",
|
||||||
|
Type t when t == typeof(byte[]) => "VARBINARY",
|
||||||
|
_ => "UNKNOWN"
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user