Skip to content

Commit d109a17

Browse files
committed
Added missing boolean
1 parent 02a1916 commit d109a17

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Credfeto.Database.Source.Generation/Helpers/ExtractColumns.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ internal static class ExtractColumns
99
{
1010
return typeName switch
1111
{
12+
"bool" => ExtractBool(source: source),
13+
"bool?" => ExtractNullableBool(source: source),
1214
"byte" => ExtractUInt8(source: source),
1315
"byte?" => ExtractNullableUInt8(source: source),
1416
"sbyte" => ExtractInt8(source: source),
@@ -43,6 +45,7 @@ internal static class ExtractColumns
4345
{
4446
return typeName switch
4547
{
48+
"bool" => ReturnBool(variable: variable),
4649
"byte" => ReturnUInt8(variable: variable),
4750
"sbyte" => ReturnInt8(variable: variable),
4851
"short" => ReturnInt16(variable: variable),
@@ -88,6 +91,11 @@ private static string ReturnInt8(string variable)
8891
return $"return Convert.ToSByte({variable});";
8992
}
9093

94+
private static string ReturnBool(string variable)
95+
{
96+
return $"return Convert.ToBoolean({variable});";
97+
}
98+
9199
private static string ReturnUInt8(string variable)
92100
{
93101
return $"return Convert.ToByte({variable});";
@@ -148,6 +156,16 @@ private static string ReturnFloat(string variable)
148156
return $"return Convert.Double({variable});";
149157
}
150158

159+
private static string ExtractBool(CodeBuilder source)
160+
{
161+
return ExtractCommon(source: source, typeName: "bool", nameof(ExtractBool), isNullable: false, getReturnStatement: ReturnBool);
162+
}
163+
164+
private static string ExtractNullableBool(CodeBuilder source)
165+
{
166+
return ExtractCommon(source: source, typeName: "bool", nameof(ExtractNullableBool), isNullable: true, getReturnStatement: ReturnBool);
167+
}
168+
151169
private static string ExtractInt8(CodeBuilder source)
152170
{
153171
return ExtractCommon(source: source, typeName: "sbyte", nameof(ExtractInt8), isNullable: false, getReturnStatement: ReturnInt8);

0 commit comments

Comments
 (0)