Skip to content

Commit

Permalink
Release: 8.0.0 (#73)
Browse files Browse the repository at this point in the history
* refactor: prefer IAsyncEnumerable<T> over Task<T[]> (#64)

* refactor: prefer IAsyncEnumerable<T> over Task<T[]>

* Empty commit

* Refactor: Deprecate Expressions (#76)

* chore: mark expression methods as obsolete

* chore: exclude obsolete methods from code coverage

* feat: replacement abstractions

1. filter by the lease scope, label, or value
2. filter by the tag label or value
3. sort by the lease scope, label, or value
4. sort by the tag label or value
5. allow an options object to be attached to a query that will allow, among other things, specifying collation for sorting purposes (since value is string and you may want to sort by numeric value)

* feat: implement new features in Common library

* feat: implement new features in MongoDb library

* refactor: update tests for new features and deprecations

* bugfix: throw NotSupportedException instead of NotImplementedException

* chore: mark obsolete method implementations

* refactor: use new enumerate method for projection repository

(stop using obsolete method)

* Refactor: Envelope Service has too many methods (#78)

* Feat: Npgsql (#80) + Implicit Usings

* refactor(test): allow each implementation to specify the exact TimeStamp it should expect to get back

instead of checking all of the possibilities

* feat: Postgres date time column supports microsecond precision

* feat: postgres driver

* refactor(test): use TestContainers package instead of docker-compose for local and other things for CI

* refactor: use getter/setter, remove redundant null assignment

* refactor: avoid magic constants

* refactor: avoid magic constants

* refactor: reduce number of params

* refactor: appease codacy

* refactor: de-duplicate json envelope logic

* refactor: reduce duplication

* refactor: reduce duplication?

* refactor: reduce duplication

* refactor: reduce duplication

* refactor: reduce duplication

* refactor: remove statics where not needed

these classes are only instantiated once, so there's no performance issues with non-static

* bugfix: wrong property name

* refactor: remove redundant initialization

* refactor: reduce duplication

* refactor: implicit usings

chops off a bunch of lines

* feat: record Data Type for Mongo

* feat: forgot to implement the postgres provisioner

* chore: update a bunch of packages

* refactor: codacy suggestion
  • Loading branch information
the-avid-engineer authored Aug 7, 2022
1 parent 03e1792 commit f668486
Show file tree
Hide file tree
Showing 330 changed files with 6,916 additions and 2,003 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 7.0.2
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 5.0.9
mongodb-replica-set: entitydb
- name: Install .NET SDK
uses: actions/setup-dotnet@v2
- name: Restore Dependencies
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 7.0.2
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 5.0.9
mongodb-replica-set: entitydb
- name: Install .NET SDK
uses: actions/setup-dotnet@v2
- name: Restore Dependencies
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 7.0.2
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 5.0.9
mongodb-replica-set: entitydb
- name: Install .NET SDK
uses: actions/setup-dotnet@v2
- name: Restore Dependencies
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
</Project>
31 changes: 29 additions & 2 deletions EntityDb.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{92484C44-2754-4C1D-BD46-98D83E4020EE}"
ProjectSection(SolutionItems) = preProject
test\Directory.Build.props = test\Directory.Build.props
test\docker-compose.yml = test\docker-compose.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.Common.Tests", "test\EntityDb.Common.Tests\EntityDb.Common.Tests.csproj", "{CF316519-525E-4A67-BF12-1FDDF802B878}"
Expand All @@ -42,7 +41,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityDb.InMemory", "src\EntityDb.InMemory\EntityDb.InMemory.csproj", "{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.InMemory", "src\EntityDb.InMemory\EntityDb.InMemory.csproj", "{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.Npgsql", "src\EntityDb.Npgsql\EntityDb.Npgsql.csproj", "{2AADF21D-4F26-4BD6-852A-B28208863FDD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.Npgsql.Provisioner", "src\EntityDb.Npgsql.Provisioner\EntityDb.Npgsql.Provisioner.csproj", "{282DFD9B-14E4-4339-B55A-3567E128FF1B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.SqlDb", "src\EntityDb.SqlDb\EntityDb.SqlDb.csproj", "{F2491666-31D1-47B5-A493-F25E167D1FDF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityDb.Json", "src\EntityDb.Json\EntityDb.Json.csproj", "{4936FFE0-98E5-43A2-89C9-0415A13CAA9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -98,6 +105,22 @@ Global
{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643}.Release|Any CPU.Build.0 = Release|Any CPU
{2AADF21D-4F26-4BD6-852A-B28208863FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AADF21D-4F26-4BD6-852A-B28208863FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AADF21D-4F26-4BD6-852A-B28208863FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AADF21D-4F26-4BD6-852A-B28208863FDD}.Release|Any CPU.Build.0 = Release|Any CPU
{282DFD9B-14E4-4339-B55A-3567E128FF1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{282DFD9B-14E4-4339-B55A-3567E128FF1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{282DFD9B-14E4-4339-B55A-3567E128FF1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{282DFD9B-14E4-4339-B55A-3567E128FF1B}.Release|Any CPU.Build.0 = Release|Any CPU
{F2491666-31D1-47B5-A493-F25E167D1FDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2491666-31D1-47B5-A493-F25E167D1FDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2491666-31D1-47B5-A493-F25E167D1FDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2491666-31D1-47B5-A493-F25E167D1FDF}.Release|Any CPU.Build.0 = Release|Any CPU
{4936FFE0-98E5-43A2-89C9-0415A13CAA9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4936FFE0-98E5-43A2-89C9-0415A13CAA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4936FFE0-98E5-43A2-89C9-0415A13CAA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4936FFE0-98E5-43A2-89C9-0415A13CAA9B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -115,6 +138,10 @@ Global
{B8B6E5A5-5154-4629-9A38-9F0E65575F30} = {92484C44-2754-4C1D-BD46-98D83E4020EE}
{FA2AD2E9-84DA-4667-BF46-140B0B050563} = {92484C44-2754-4C1D-BD46-98D83E4020EE}
{31C5BEDB-9B04-4FE4-9AF5-AE682C0E7643} = {ABACFBCC-B59F-4616-B6CC-99C37AEC8960}
{2AADF21D-4F26-4BD6-852A-B28208863FDD} = {ABACFBCC-B59F-4616-B6CC-99C37AEC8960}
{282DFD9B-14E4-4339-B55A-3567E128FF1B} = {ABACFBCC-B59F-4616-B6CC-99C37AEC8960}
{F2491666-31D1-47B5-A493-F25E167D1FDF} = {ABACFBCC-B59F-4616-B6CC-99C37AEC8960}
{4936FFE0-98E5-43A2-89C9-0415A13CAA9B} = {ABACFBCC-B59F-4616-B6CC-99C37AEC8960}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E9D288EE-9351-4018-ABE8-B0968AEB0465}
Expand Down
5 changes: 1 addition & 4 deletions src/EntityDb.Abstractions/Agents/IAgentAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Agents;
namespace EntityDb.Abstractions.Agents;

/// <summary>
/// Represents a type that can access an instance of <see cref="IAgent" />.
Expand Down
4 changes: 0 additions & 4 deletions src/EntityDb.Abstractions/Agents/IAgentSignatureAugmenter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Agents;

/// <summary>
Expand Down
4 changes: 1 addition & 3 deletions src/EntityDb.Abstractions/Disposables/IDisposableResource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace EntityDb.Abstractions.Disposables;
namespace EntityDb.Abstractions.Disposables;

/// <summary>
/// Marks a resource as disposable and provides a default implementation.
Expand Down
3 changes: 0 additions & 3 deletions src/EntityDb.Abstractions/Entities/IEntityRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
using EntityDb.Abstractions.Snapshots;
using EntityDb.Abstractions.Transactions;
using EntityDb.Abstractions.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Entities;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Entities;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
using EntityDb.Abstractions.Snapshots;
using EntityDb.Abstractions.Transactions;
using EntityDb.Abstractions.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Projections;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Threading;
using System.Threading.Tasks;

namespace EntityDb.Abstractions.Projections;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using EntityDb.Abstractions.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

namespace EntityDb.Abstractions.Queries.FilterBuilders;
Expand All @@ -10,6 +10,12 @@ namespace EntityDb.Abstractions.Queries.FilterBuilders;
/// <typeparam name="TFilter">The type of filter used by the repository.</typeparam>
public interface IAgentSignatureFilterBuilder<TFilter> : IFilterBuilder<TFilter>
{
/// <ignore/>
[Obsolete("This method will be removed in the future, and may not be supported for all implementations.")]
[ExcludeFromCodeCoverage(Justification = "Obsolete")]
TFilter AgentSignatureMatches<TAgentSignature>(Expression<Func<TAgentSignature, bool>> agentSignatureExpression)
=> throw new NotSupportedException();

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes agentSignatures with any entity id which is contained
/// in a set
Expand All @@ -33,16 +39,4 @@ public interface IAgentSignatureFilterBuilder<TFilter> : IFilterBuilder<TFilter>
/// <paramref name="agentSignatureTypes" />.
/// </returns>
TFilter AgentSignatureTypeIn(params Type[] agentSignatureTypes);

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes agentSignatures which do match a agentSignature
/// expression.
/// </summary>
/// <typeparam name="TAgentSignature">The type of agentSignature in the agentSignature expression.</typeparam>
/// <param name="agentSignatureExpression">The agentSignature expression.</param>
/// <returns>
/// A <typeparamref name="TFilter" /> that only includes agentSignatures which do match
/// <paramref name="agentSignatureExpression" />.
/// </returns>
TFilter AgentSignatureMatches<TAgentSignature>(Expression<Func<TAgentSignature, bool>> agentSignatureExpression);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using EntityDb.Abstractions.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

namespace EntityDb.Abstractions.Queries.FilterBuilders;
Expand All @@ -10,6 +10,12 @@ namespace EntityDb.Abstractions.Queries.FilterBuilders;
/// <typeparam name="TFilter">The type of filter used by the repository.</typeparam>
public interface ICommandFilterBuilder<TFilter> : IFilterBuilder<TFilter>
{
/// <ignore/>
[Obsolete("This method will be removed in the future, and may not be supported for all implementations.")]
[ExcludeFromCodeCoverage(Justification = "Obsolete")]
TFilter CommandMatches<TCommand>(Expression<Func<TCommand, bool>> commandExpression)
=> throw new NotSupportedException();

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes commands with an entity id which is contained in a set
/// of entity ids.
Expand Down Expand Up @@ -53,15 +59,4 @@ public interface ICommandFilterBuilder<TFilter> : IFilterBuilder<TFilter>
/// <paramref name="commandTypes" />.
/// </returns>
TFilter CommandTypeIn(params Type[] commandTypes);

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes commands which do match a command expression.
/// </summary>
/// <typeparam name="TCommand">The type of command in the command expression.</typeparam>
/// <param name="commandExpression">The command expression.</param>
/// <returns>
/// A <typeparamref name="TFilter" /> that only includes commands which do match
/// <paramref name="commandExpression" />.
/// </returns>
TFilter CommandMatches<TCommand>(Expression<Func<TCommand, bool>> commandExpression);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using EntityDb.Abstractions.ValueObjects;
using System;
using EntityDb.Abstractions.Leases;
using EntityDb.Abstractions.ValueObjects;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

namespace EntityDb.Abstractions.Queries.FilterBuilders;
Expand All @@ -10,6 +11,12 @@ namespace EntityDb.Abstractions.Queries.FilterBuilders;
/// <typeparam name="TFilter">The type of filter used by the repository.</typeparam>
public interface ILeaseFilterBuilder<TFilter> : IFilterBuilder<TFilter>
{
/// <ignore/>
[Obsolete("This method will be removed in the future.")]
[ExcludeFromCodeCoverage(Justification = "Obsolete")]
TFilter LeaseMatches<TLease>(Expression<Func<TLease, bool>> leaseExpression)
=> throw new NotSupportedException();

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes leases with an entity id which is contained in a set
/// of entity ids.
Expand Down Expand Up @@ -55,13 +62,35 @@ public interface ILeaseFilterBuilder<TFilter> : IFilterBuilder<TFilter>
TFilter LeaseTypeIn(params Type[] leaseTypes);

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes leases which do match a lease expression.
/// Returns a <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Scope"/> is
/// a particular value.
/// </summary>
/// <param name="scope">The lease scope</param>
/// <returns>
/// A <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Scope"/> is
/// <paramref name="scope"/>.
/// </returns>
TFilter LeaseScopeEq(string scope);

/// <summary>
/// Returns a <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Label"/> is
/// a particular value.
/// </summary>
/// <param name="label">The lease label</param>
/// <returns>
/// A <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Label"/> is
/// <paramref name="label"/>.
/// </returns>
TFilter LeaseLabelEq(string label);

/// <summary>
/// Returns a <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Value"/> is
/// a particular value.
/// </summary>
/// <typeparam name="TLease">The type of lease in the lease expression.</typeparam>
/// <param name="leaseExpression">The lease expression.</param>
/// <param name="value">The lease value</param>
/// <returns>
/// A <typeparamref name="TFilter" /> that only includes leases which do match <paramref name="leaseExpression" />
/// .
/// A <typeparamref name="TFilter"/> that only includes leases whose <see cref="ILease.Value"/> is
/// <paramref name="value"/>.
/// </returns>
TFilter LeaseMatches<TLease>(Expression<Func<TLease, bool>> leaseExpression);
TFilter LeaseValueEq(string value);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using EntityDb.Abstractions.Tags;
using EntityDb.Abstractions.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

namespace EntityDb.Abstractions.Queries.FilterBuilders;
Expand All @@ -10,6 +11,12 @@ namespace EntityDb.Abstractions.Queries.FilterBuilders;
/// <typeparam name="TFilter">The type of filter used by the repository.</typeparam>
public interface ITagFilterBuilder<TFilter> : IFilterBuilder<TFilter>
{
/// <ignore/>
[Obsolete("This method will be removed in the future, and may not be supported for all implementations.")]
[ExcludeFromCodeCoverage(Justification = "Obsolete")]
TFilter TagMatches<TTag>(Expression<Func<TTag, bool>> tagExpression)
=> throw new NotSupportedException();

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes tags with an entity id which is contained in a set of
/// entity ids.
Expand Down Expand Up @@ -54,10 +61,24 @@ public interface ITagFilterBuilder<TFilter> : IFilterBuilder<TFilter>
TFilter TagTypeIn(params Type[] tagTypes);

/// <summary>
/// Returns a <typeparamref name="TFilter" /> that only includes tags which do match a tag expression.
/// Returns a <typeparamref name="TFilter"/> that only includes tags whose <see cref="ITag.Label"/> is
/// a particular value.
/// </summary>
/// <param name="label">The tag labels</param>
/// <returns>
/// A <typeparamref name="TFilter"/> that only includes tags whose <see cref="ITag.Label"/> is
/// <paramref name="label"/>.
/// </returns>
TFilter TagLabelEq(string label);

/// <summary>
/// Returns a <typeparamref name="TFilter"/> that only includes tags whose <see cref="ITag.Value"/> is
/// a particular value.
/// </summary>
/// <typeparam name="TTag">The type of tag in the tag expression.</typeparam>
/// <param name="tagExpression">The tag expression.</param>
/// <returns>A <typeparamref name="TFilter" /> that only includes tags which do match <paramref name="tagExpression" />.</returns>
TFilter TagMatches<TTag>(Expression<Func<TTag, bool>> tagExpression);
/// <param name="value">The tag values</param>
/// <returns>
/// A <typeparamref name="TFilter"/> that only includes tags whose <see cref="ITag.Value"/> is
/// <paramref name="value"/>.
/// </returns>
TFilter TagValueEq(string value);
}
5 changes: 5 additions & 0 deletions src/EntityDb.Abstractions/Queries/IQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ public interface IQuery
/// The number of objects to take.
/// </summary>
int? Take { get; }

/// <summary>
/// Driver-specific options for this query
/// </summary>
object? Options { get; }
}
Loading

0 comments on commit f668486

Please sign in to comment.