Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed May 17, 2024
1 parent d9bcde5 commit 440b2bc
Showing 1 changed file with 9 additions and 30 deletions.
39 changes: 9 additions & 30 deletions src/RepoM.App/RepositoryFiltering/RepositoryMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,16 @@ public RepositoryMatcher(IEnumerable<IQueryMatcher> matchers)

public bool Matches(IRepository repository, IQuery query)
{
if (query is TrueQuery)
return query switch
{
return true;
}

if (query is FalseQuery)
{
return false;
}

if (query is AndQuery and)
{
return HandleAnd(repository, and);
}

if (query is OrQuery or)
{
return HandleOr(repository, or);
}

if (query is NotQuery not)
{
return !Matches(repository, not.Item);
}

if (query is TermBase st)
{
return HandleTerm(repository, st);
}

return true;
TrueQuery => true,
FalseQuery => false,
AndQuery and => HandleAnd(repository, and),
OrQuery or => HandleOr(repository, or),
NotQuery not => !Matches(repository, not.Item),
TermBase st => HandleTerm(repository, st),
_ => true,
};

Check warning on line 32 in src/RepoM.App/RepositoryFiltering/RepositoryMatcher.cs

View check run for this annotation

Codecov / codecov/patch

src/RepoM.App/RepositoryFiltering/RepositoryMatcher.cs#L25-L32

Added lines #L25 - L32 were not covered by tests
}

private bool HandleTerm(IRepository repository, TermBase termBase)
Expand Down

0 comments on commit 440b2bc

Please sign in to comment.