Skip to content

Commit

Permalink
Support for DateOnly #276 (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkWanderer authored Mar 7, 2023
1 parent 1388e87 commit dc43db0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ClickHouse.Client.Tests/Types/TypeMappingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public class TypeMappingTests
[TestCase(typeof(uint?), ExpectedResult = "Nullable(UInt32)")]
[TestCase(typeof(uint?[]), ExpectedResult = "Array(Nullable(UInt32))")]
[TestCase(typeof(string[][]), ExpectedResult = "Array(Array(String))")]
#if NET6_0_OR_GREATER
[TestCase(typeof(DateOnly), ExpectedResult = "Date")]
#endif
[TestCase(typeof(Tuple<int, byte, float?, string[]>), ExpectedResult = "Tuple(Int32,UInt8,Nullable(Float32),Array(String))")]
public string ShouldConvertToClickHouseType(Type type) => TypeConverter.ToClickHouseType(type).ToString();

Expand Down
2 changes: 1 addition & 1 deletion ClickHouse.Client/ClickHouse.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net48;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/DarkWanderer/ClickHouse.Client</PackageProjectUrl>
<RepositoryUrl>https://github.com/DarkWanderer/ClickHouse.Client</RepositoryUrl>
Expand Down
3 changes: 3 additions & 0 deletions ClickHouse.Client/Types/TypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ static TypeConverter()
// Mapping fixups
ReverseMapping.Add(typeof(ClickHouseDecimal), new Decimal128Type());
ReverseMapping.Add(typeof(decimal), new Decimal128Type());
#if NET6_0_OR_GREATER
ReverseMapping.Add(typeof(DateOnly), new DateType());
#endif
ReverseMapping[typeof(DateTime)] = new DateTimeType();
ReverseMapping[typeof(DateTimeOffset)] = new DateTimeType();
}
Expand Down

0 comments on commit dc43db0

Please sign in to comment.