Sidub.Platform.Filter
1.1.6
Prefix Reserved
See the version list below for details.
dotnet add package Sidub.Platform.Filter --version 1.1.6
NuGet\Install-Package Sidub.Platform.Filter -Version 1.1.6
<PackageReference Include="Sidub.Platform.Filter" Version="1.1.6" />
paket add Sidub.Platform.Filter --version 1.1.6
#r "nuget: Sidub.Platform.Filter, 1.1.6"
// Install Sidub.Platform.Filter as a Cake Addin #addin nuget:?package=Sidub.Platform.Filter&version=1.1.6 // Install Sidub.Platform.Filter as a Cake Tool #tool nuget:?package=Sidub.Platform.Filter&version=1.1.6
Sidub Platform - Filter
This repository contains the filter module for the Sidub Platform. Filter concept abstractions allow definition of filters while language-specific parser implementations allow for the parsing of filter definitions.
Main Components
Filter Concepts
A filter is represented as an IFilter
with FilterPredicate
,
FilterPipeline
and FilterLogicalOperator
as the main concrete concepts.
The FilterPredicate
is the basic building block of a filter and represents a
single condition. The FilterPipeline
is a collection of IFilter
instances
and the FilterLogicalOperator
is used to combine IFilter
instances within
the a pipeline.
Filters may be built using the FilterBuilder
class which provides a fluent
API for building filters.
Filter Parsing
A filter representation can be parsed to its string representation using the appropriate parser. Various language-specific parsers exist to parse filters to appropriate string representations.
Usage
While filters can be manually composed using the respective IFilter
implementations, the FilterBuilder
class provides a fluent API for building
filters. Once prepared, the filter can be parsed to its string representation
using the appropriate parser service.
Building a Filter
To build a simple filter, you can use the FilterBuilder
as follows:
var builder = new FilterBuilder();
var filter = builder
.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
.Build();
For filters with multiple conditions, you can use the FilterPipeline
and
FilterLogicalOperator
as follows:
var builder = new FilterBuilder();
var filter = builder
.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
.Add(LogicalOperator.And)
.Add("FieldB", ComparisonOperator.NotEquals, "FieldBTestValue");
Pipelines can be nested to create more advanced filters:
var builder = new FilterBuilder();
var filter = builder
.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
.Add(LogicalOperator.And)
.Add(inner1 => inner1
.Add("FieldB", ComparisonOperator.Equals, "FieldBTestValue01")
.Add(LogicalOperator.Or)
.Add("FieldB", ComparisonOperator.Equals, "FieldBTestValue02"));
Parsing a Filter
To parse a filter to its string representation, you can use the appropriate
parser service. Concrete implementations of the
IFilterService<TConfiguration>
interface are provided for various languages.
private readonly ODataFilterService _filterService;
public ProductService(ODataFilterService filterService)
{
_filterService = filterService;
}
public string BuildProductQuery(ProductFilter productFilter)
{
return _filterService.Parse(filterFilter);
}
Considerations
The library currently only supports implementations in which the filter is parsed to a string representation. Future implemenations will evolve this concept to support more advanced use-cases, such as applying the filter against an in-memory collection or against other query constructs.
License
This project is dual-licensed under the AGPL v3 or a proprietary license. For details, see https://sidub.ca/licensing or the LICENSE.txt file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.SourceLink.AzureRepos.Git (>= 8.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Sidub.Platform.Filter:
Package | Downloads |
---|---|
Sidub.Platform.Storage
Storage framework library for Sidub platform. |
|
Sidub.Platform.Storage.Http
HTTP storage framework library for Sidub platform. |
|
Sidub.Platform.Storage.Gremlin
Gremlin storage framework library for Sidub platform. |
GitHub repositories
This package is not used by any popular GitHub repositories.