Skip to content

Commit

Permalink
v0.4.10 and .net 9.0 target
Browse files Browse the repository at this point in the history
  • Loading branch information
oruchreis committed Nov 28, 2024
1 parent 187001d commit c778331
Show file tree
Hide file tree
Showing 25 changed files with 187 additions and 99 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-version: '9.x'
- name: Publish Nuget Package
uses: alirezanet/[email protected]
with:
PROJECT_FILE_PATH: src/ReindexerNet.${{ matrix.project }}/ReindexerNet.${{ matrix.project }}.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
TAG_FORMAT: v*
INCLUDE_SYMBOLS: true
4 changes: 4 additions & 0 deletions .github/workflows/unix-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
./dotnet-install.sh --channel 6.0 --install-dir ~/.dotnet
./dotnet-install.sh --channel 7.0 --install-dir ~/.dotnet
./dotnet-install.sh --channel 8.0 --install-dir ~/.dotnet
./dotnet-install.sh --channel 9.0 --install-dir ~/.dotnet
echo "DOTNET_ROOT=~/.dotnet" >> $GITHUB_ENV
echo "$DOTNET_ROOT" >> $GITHUB_PATH
echo "$DOTNET_ROOT/tools" >> $GITHUB_PATH
Expand Down Expand Up @@ -101,6 +102,9 @@ jobs:
- name: List SDKs
run: ~/.dotnet/dotnet --list-sdks
shell: shell.sh {0}
- name: Test .NET 9
run: ~/.dotnet/dotnet test -v quiet -f net9.0 -r ${{ matrix.target.rid }} --logger "console;verbosity=detailed" --nologo /nologo
shell: shell.sh {0}
- name: Test .NET 8
run: ~/.dotnet/dotnet test -v quiet -f net8.0 -r ${{ matrix.target.rid }} --logger "console;verbosity=detailed" --nologo /nologo
shell: shell.sh {0}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/windows-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
./dotnet-install.ps1 -Channel 6.0 -Architecture ${{ matrix.target.arch }} -InstallDir "${{ matrix.target.programFiles }}\dotnet"
./dotnet-install.ps1 -Channel 7.0 -Architecture ${{ matrix.target.arch }} -InstallDir "${{ matrix.target.programFiles }}\dotnet"
./dotnet-install.ps1 -Channel 8.0 -Architecture ${{ matrix.target.arch }} -InstallDir "${{ matrix.target.programFiles }}\dotnet"
./dotnet-install.ps1 -Channel 9.0 -Architecture ${{ matrix.target.arch }} -InstallDir "${{ matrix.target.programFiles }}\dotnet"
dotnet --list-sdks
#- name: Setup .NET Sdk
# uses: actions/setup-dotnet@v3
Expand All @@ -45,6 +46,8 @@ jobs:
# 6.x
# 7.x
# 8.x
- name: Test .NET 8 ${{ matrix.target.arch }}
run: dotnet test -v quiet -f net9.0 --logger "console;verbosity=detailed" --runtime win-${{ matrix.target.arch }}
- name: Test .NET 8 ${{ matrix.target.arch }}
run: dotnet test -v quiet -f net8.0 --logger "console;verbosity=detailed" --runtime win-${{ matrix.target.arch }}
- name: Test .NET 7 ${{ matrix.target.arch }}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.10] - 2024-11-28
## Added
- .NET 9.0 target
- Added more tests for nullable types(sparse indicies)
- Symbol packages
### Fixed
- Fixed Join queries for embedded client on .net 4.7.2

## [0.4.9 Embedded] - 2024-11-05
### Fixed
- Face and swagger ui hadn't included in previous embedded windows package.
Expand Down
2 changes: 1 addition & 1 deletion ReindexerNet.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
Expand Down
37 changes: 37 additions & 0 deletions ReindexerNet.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Folder Name="/Libraries/">
<File Path="src\Directory.Build.props" />
<Project Path="src\ReindexerNet.Core\ReindexerNet.Core.csproj" />
<Project Path="src\ReindexerNet.Embedded\ReindexerNet.Embedded.csproj" />
<Project Path="src\ReindexerNet.Remote.Grpc\ReindexerNet.Remote.Grpc.csproj" />
<Project Path="src\ReindexerNet.Remote.OpenApi\ReindexerNet.Remote.OpenApi.csproj" />
</Folder>
<Folder Name="/NativeAssets/">
<Project Path="src\ReindexerNet.Embedded.NativeAssets.AlpineLinux-x64\ReindexerNet.Embedded.NativeAssets.AlpineLinux-x64.csproj" />
<Project Path="src\ReindexerNet.Embedded.NativeAssets.Linux-x64\ReindexerNet.Embedded.NativeAssets.Linux-x64.csproj" />
<Project Path="src\ReindexerNet.Embedded.NativeAssets.Osx-x64\ReindexerNet.Embedded.NativeAssets.Osx-x64.csproj" />
<Project Path="src\ReindexerNet.Embedded.NativeAssets.Win-x64\ReindexerNet.Embedded.NativeAssets.Win-x64.csproj" />
<Project Path="src\ReindexerNet.Embedded.NativeAssets.Win-x86\ReindexerNet.Embedded.NativeAssets.Win-x86.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path=".github\workflows\build.yml" />
<File Path=".github\workflows\unix-test.yml" />
<File Path=".github\workflows\windows-test.yml" />
<File Path="CHANGELOG.md" />
<File Path="README.md" />
</Folder>
<Folder Name="/Tests/">
<Project Path="Tests\ReindexerNet.CoreTest\ReindexerNet.CoreTest.csproj" />
<Project Path="Tests\ReindexerNet.EmbeddedBenchmarks\ReindexerNet.EmbeddedBenchmarks.csproj" />
<Project Path="Tests\ReindexerNet.EmbeddedTest\ReindexerNet.EmbeddedTest.csproj" />
<Project Path="Tests\ReindexerNet.RemoteTest\ReindexerNet.RemoteTest.csproj" />
</Folder>
<Properties Name="Visual Studio">
<Property Name="OpenWith" Value="17" />
</Properties>
</Solution>
67 changes: 66 additions & 1 deletion Tests/ReindexerNet.CoreTest/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,37 @@ private async Task AddIndexesAsync()
FieldType = FieldType.Int64,
IndexType = IndexType.Hash
},
new Index
{
Name = "NullableInt64",
FieldType = FieldType.Int64,
IndexType = IndexType.Hash,
IsSparse = true
},
new Index
{
Name = "NullableArray",
FieldType = FieldType.String,
IndexType = IndexType.Hash,
IsSparse = true,
IsArray = true
},
new Index
{
Name = "NullableSortable",
FieldType = FieldType.Double,
IndexType = IndexType.Tree,
IsSparse = true
},
new Index
{
Name = "NullableColumnIndex",
FieldType = FieldType.Bool,
IndexType = IndexType.ColumnIndex,
IsSparse = true,
IsDense = true
}

})
{
await Client.AddIndexAsync(NsName, index);
Expand Down Expand Up @@ -130,6 +161,10 @@ public class TestDocument
public int? NullableIntPayload { get; set; }
public string? Utf8String { get; set; }
public int Group { get; set; }
public long? NullableInt64 { get; set; }
public string?[]? NullableArray { get; set; }
public double? NullableSortable { get; set; }
public bool? NullableColumnIndex { get; set; }
}

private async Task<List<TestDocument>> AddItemsAsync(int idStart, int idEnd)
Expand All @@ -145,7 +180,11 @@ private async Task<List<TestDocument>> AddItemsAsync(int idStart, int idEnd)
NullablePayload = i % 2 == 0 ? i.ToString() : null,
NullableIntPayload = i % 2 == 0 ? i : (int?)null,
Utf8String = "ÇŞĞÜÖİöçşğüı" + i,
Group = i % 3
Group = i % 3,
NullableInt64 = i % 3 == 0 ? i : (long?)null,
NullableArray = i % 3 == 0 ? Enumerable.Range(0, i).Select(r => i % 2 == 0 && r == 0 ? null : $"..{r}..").ToArray() : null,
NullableSortable = i % 3 == 0 ? i * 0.125 : (double?)null,
NullableColumnIndex = i % 3 == 0 ? i % 2 == 0 : (bool?)null
}).ToList();
var insertedItemCount = await Client.UpsertAsync(NsName, entities);

Expand Down Expand Up @@ -325,6 +364,32 @@ public async Task QueryBuilderTest_InsertAndQuery()
CollectionAssert.AreEqual(Enumerable.Range(0, 2).Select(r => (byte)(r % 255)).ToArray(), item.Payload);
}

[TestMethod]
public async Task QueryBuilderTest_NullableSearch()
{
await AddIndexesAsync();
var insertedItems = await AddItemsAsync(0, 1000);
var nullableInt64s = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.WhereInt64("NullableInt64", Condition.EMPTY));
CollectionAssert.AreEqual(insertedItems.Where(i => i.NullableInt64 == null).Select(i => i.Id).ToList(), nullableInt64s.Items.Select(i => i.Id).ToList());

var nullableArrays = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.Not().WhereString("NullableArray", Condition.ANY));
CollectionAssert.AreEqual(insertedItems.Where(i => i.NullableArray == null || i.NullableArray.Length == 0).Select(i => i.Id).ToList(), nullableArrays.Items.Select(i => i.Id).ToList());
//var all = await Client.ExecuteAsync<TestDocument>(NsName,q => { });
var nullableArrayContainsNulls = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.WhereString("NullableArray", Condition.EMPTY).And().WhereString("NullableArray", Condition.ANY));//WHERE NullableArray IS NULL AND NullableArray IS NOT EMPTY
CollectionAssert.AreEqual(insertedItems.Where(i => i.NullableArray != null && i.NullableArray.Contains(null)).Select(i => i.Id).ToList(), nullableArrayContainsNulls.Items.Select(i => i.Id).ToList());

var nullableSortable = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.WhereDouble("NullableSortable", Condition.EMPTY));
CollectionAssert.AreEqual(insertedItems.Where(i => i.NullableSortable == null).Select(i => i.Id).ToList(), nullableSortable.Items.Select(i => i.Id).ToList());

var nullableColumnIndex = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.WhereBool("NullableColumnIndex", Condition.EMPTY));
CollectionAssert.AreEqual(insertedItems.Where(i => i.NullableColumnIndex == null).Select(i => i.Id).ToList(), nullableColumnIndex.Items.Select(i => i.Id).ToList());
}

[TestMethod]
public async Task QueryBuilderTest_SingleSort()
{
Expand Down
12 changes: 6 additions & 6 deletions Tests/ReindexerNet.CoreTest/ReindexerNet.CoreTest.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand All @@ -15,10 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
14 changes: 9 additions & 5 deletions Tests/ReindexerNet.EmbeddedBenchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ namespace ReindexerNetBenchmark.EmbeddedBenchmarks;

public class Program
{
public static void Main(string[] args)
{

#if DEBUG
var b = new SelectSinglePK{ N = 1000 };
b.RealmSetup();
public static async Task Main(string[] args)
{
var b = new SelectSinglePK { N = 1000 };
await b.RealmSetupAsync();
b.Realm();
b.RealmClean();
}
#else
public static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
#endif
}
#endif
}

public class AntiVirusFriendlyConfig : ManualConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>ReindexerNetBenchmark</RootNamespace>
Expand All @@ -12,7 +12,7 @@
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Cachalot.Client" Version="2.5.13" />
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="MessagePack" Version="2.5.192" />
<PackageReference Include="Realm" Version="20.0.0" />
<PackageReference Include="SpanJson" Version="4.2.1" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Tests/ReindexerNet.EmbeddedTest/ReindexerBindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public void DropNamespace()
private const string FrameworkName = "NET7";
#elif NET8_0
private const string FrameworkName = "NET8";
#elif NET9_0
private const string FrameworkName = "NET9";
#elif NETCOREAPP2_2
private const string FrameworkName="NETCOREAPP2_2";
#elif NETCOREAPP3_1
Expand Down
14 changes: 7 additions & 7 deletions Tests/ReindexerNet.EmbeddedTest/ReindexerNet.EmbeddedTest.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand All @@ -15,14 +15,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="'$(TargetFramework)' == 'net472'" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions Tests/ReindexerNet.RemoteTest/ReindexerNet.RemoteTest.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;net472</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand All @@ -15,10 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netstandard2.0;net472;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net8.0;net7.0;net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netstandard2.0;net472;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsPlatform('Windows'))">net9.0;net8.0;net7.0;net6.0;net5.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<Authors>oruchreis</Authors>
<Copyright>oruchreis</Copyright>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -10,15 +10,15 @@
<PackageProjectUrl>https://github.com/oruchreis/ReindexerNet</PackageProjectUrl>
<RepositoryUrl>https://github.com/oruchreis/ReindexerNet.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<LangVersion>preview</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ReindexerNet.Core/Internal/CJsonWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void PutCArrayTag(CArrayTag cArrayTag)
public void Append(CJsonWriter other)
{
#if NETSTANDARD2_0 || NET472
var otherSpan = other._buffer.AsSpan().Slice(other._pos);
var otherSpan = other._buffer.AsSpan().Slice(0, other._pos);
#else
var otherSpan = other._buffer.AsSpan()[..other._pos];
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ReindexerNet.Core/ReindexerJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ReindexerJsonSerializer : IReindexerSerializer
{
private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Converters = { new DoubleConverter() }
};

Expand Down
Loading

0 comments on commit c778331

Please sign in to comment.