Skip to content

Commit 965300d

Browse files
Fix type mapping for offline mode: UuidType->Guid, DateTimeOffsetType->DateTimeOffset, etc.
1 parent f09d16f commit 965300d

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

  • DataProvider/Nimblesite.DataProvider.Postgres.Cli

DataProvider/Nimblesite.DataProvider.Postgres.Cli/Program.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,7 @@ private static string MapPostgresTypeToCSharp(string pgType, bool isNullable)
14881488
{
14891489
var baseType = pgType.ToLowerInvariant() switch
14901490
{
1491+
// PostgreSQL native types
14911492
"uuid" => "Guid",
14921493
"boolean" or "bool" => "bool",
14931494
"smallint" or "int2" => "short",
@@ -1507,6 +1508,34 @@ private static string MapPostgresTypeToCSharp(string pgType, bool isNullable)
15071508
"string",
15081509
"json" or "jsonb" => "string",
15091510
var t when t.EndsWith("[]", StringComparison.Ordinal) => "string[]",
1511+
1512+
// PortableType names (from schema.yaml)
1513+
"uuidtype" => "Guid",
1514+
"booleantype" => "bool",
1515+
"smallinttype" => "short",
1516+
"inttype" => "int",
1517+
"biginttype" => "long",
1518+
"floattype" => "float",
1519+
"doubletype" => "double",
1520+
"decimaltype" => "decimal",
1521+
"moneytype" => "decimal",
1522+
"smallmoneytype" => "decimal",
1523+
"datetype" => "DateOnly",
1524+
"timetype" => "TimeOnly",
1525+
"datetimetype" => "DateTime",
1526+
"datetimeoffsettype" => "DateTimeOffset",
1527+
"texttype" => "string",
1528+
"chartype" => "string",
1529+
"varchartype" => "string",
1530+
"nchartype" => "string",
1531+
"nvarchartype" => "string",
1532+
"jsontype" => "string",
1533+
"xmltype" => "string",
1534+
"binarytype" => "byte[]",
1535+
"varbinarytype" => "byte[]",
1536+
"blobtype" => "byte[]",
1537+
"rowversiontype" => "byte[]",
1538+
15101539
_ => "string",
15111540
};
15121541

0 commit comments

Comments
 (0)