-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* support cast function
- Loading branch information
Showing
13 changed files
with
166 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/OData.QueryBuilder/Conventions/Functions/IConvertFunction.cs
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
src/OData.QueryBuilder/Conventions/Functions/ICustomFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
/// <summary> | ||
/// Custom functions | ||
/// </summary> | ||
public interface ICustomFunction | ||
{ | ||
/// <summary> | ||
/// Convert enum to string | ||
/// </summary> | ||
T ConvertEnumToString<T>(T value) where T : Enum; | ||
|
||
/// <summary> | ||
/// Convert datetime to string | ||
/// </summary> | ||
DateTime ConvertDateTimeToString(DateTime value, string format); | ||
|
||
/// <summary> | ||
/// Convert datetimeoffset to string | ||
/// </summary> | ||
DateTimeOffset ConvertDateTimeOffsetToString(DateTimeOffset value, string format); | ||
|
||
/// <summary> | ||
/// Replace characters | ||
/// </summary> | ||
string ReplaceCharacters(string value, IDictionary<string, string> keyValuePairs); | ||
|
||
/// <summary> | ||
/// Replace characters | ||
/// </summary> | ||
IEnumerable<string> ReplaceCharacters(IEnumerable<string> values, IDictionary<string, string> keyValuePairs); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/OData.QueryBuilder/Conventions/Functions/IODataFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
public interface IODataFunction : IODataStringAndCollectionFunction, IODataDateFunction, IConvertFunction, IReplaceFunction | ||
/// <summary> | ||
/// OData functions | ||
/// </summary> | ||
public interface IODataFunction : IODataStringAndCollectionFunction, IODataDateTimeFunction, ICustomFunction, ITypeFunction | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/OData.QueryBuilder/Conventions/Functions/IReplaceFunction.cs
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/OData.QueryBuilder/Conventions/Functions/ISortFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
/// <summary> | ||
/// Sort functions | ||
/// </summary> | ||
public interface ISortFunction | ||
{ | ||
/// <summary> | ||
/// Sort ascending | ||
/// </summary> | ||
ISortFunction Ascending<T>(T column); | ||
|
||
/// <summary> | ||
/// Sort descending | ||
/// </summary> | ||
ISortFunction Descending<T>(T column); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/OData.QueryBuilder/Conventions/Functions/ITypeFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
/// <summary> | ||
/// https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_TypeFunctions | ||
/// </summary> | ||
public interface ITypeFunction | ||
{ | ||
/// <summary> | ||
/// https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_cast | ||
/// </summary> | ||
/// <param name="columnName">Column name</param> | ||
/// <param name="type">https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/entity-data-model-primitive-data-types#primitive-data-types-supported-in-the-entity-data-model</param> | ||
/// <returns></returns> | ||
string Cast(string columnName, string type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<IsPackable>true</IsPackable> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<PackageId>OData.QueryBuilder</PackageId> | ||
<PackageVersion>$(PackageVersion)</PackageVersion> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
<PackageProjectUrl>https://github.com/ZEXSM/OData.QueryBuilder</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/ZEXSM/OData.QueryBuilder</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>odata;querybuilder;dotnet;charp</PackageTags> | ||
<Authors>ZEXSM</Authors> | ||
<Description>The library primarily targets OData Version 4.01 and provides linq syntax for creating OData queries based on a data model.</Description> | ||
<LangVersion>8.0</LangVersion> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<IsPackable>true</IsPackable> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<PackageId>OData.QueryBuilder</PackageId> | ||
<PackageVersion>$(PackageVersion)</PackageVersion> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
<PackageProjectUrl>https://github.com/ZEXSM/OData.QueryBuilder</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/ZEXSM/OData.QueryBuilder</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>odata;querybuilder;dotnet;charp</PackageTags> | ||
<Authors>ZEXSM</Authors> | ||
<Description>The library primarily targets OData Version 4.01 and provides linq syntax for creating OData queries based on a data model.</Description> | ||
<LangVersion>8.0</LangVersion> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
<Target Name="RestoreTools" BeforeTargets="Build"> | ||
<Exec Command="dotnet tool restore" /> | ||
</Target> | ||
<Target Name="RestoreTools" BeforeTargets="Build"> | ||
<Exec Command="dotnet tool restore" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters