Skip to content

Commit 106ce68

Browse files
feature: query for an exact tag
1 parent 233c813 commit 106ce68

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using EntityDb.Abstractions.Queries;
2+
using EntityDb.Abstractions.Queries.FilterBuilders;
3+
using EntityDb.Abstractions.Queries.SortBuilders;
4+
using EntityDb.Abstractions.Tags;
5+
using EntityDb.Common.Tags;
6+
7+
namespace EntityDb.Common.Queries
8+
{
9+
/// <summary>
10+
/// A query for the exact tag.
11+
/// </summary>
12+
public sealed record ExactTagQuery(ITag Tag) : ITagQuery
13+
{
14+
public TFilter GetFilter<TFilter>(ITagFilterBuilder<TFilter> builder)
15+
{
16+
return builder.TagMatches<Tag>((x) =>
17+
x.Scope == Tag.Scope &&
18+
x.Label == Tag.Label &&
19+
x.Value == Tag.Value);
20+
}
21+
22+
public TSort? GetSort<TSort>(ITagSortBuilder<TSort> builder)
23+
{
24+
return default;
25+
}
26+
27+
public int? Skip => null;
28+
29+
public int? Take => 1;
30+
}
31+
}

0 commit comments

Comments
 (0)