Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefh/hotchocolate.data.extensions
Contains some "IgnoreCase" String filters for eq, contains, endsWith and startsWith.
https://github.com/stefh/hotchocolate.data.extensions
Last synced: 20 days ago
JSON representation
Contains some "IgnoreCase" String filters for eq, contains, endsWith and startsWith.
- Host: GitHub
- URL: https://github.com/stefh/hotchocolate.data.extensions
- Owner: StefH
- Created: 2021-08-28T18:50:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T08:06:21.000Z (about 1 year ago)
- Last Synced: 2024-04-12T16:44:23.872Z (7 months ago)
- Language: C#
- Homepage:
- Size: 347 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# HotChocolate.Data.Extensions
Contains some extra String filters like:
- eqIgnoreCase / neqIgnoreCase
- containsIgnoreCase / ncontainsIgnoreCase
- endsWithIgnoreCase / nendsWithIgnoreCase
- startsWithIgnoreCase / nstartsWithIgnoreCase## NuGet packages
| Name | NuGet | Info |
|:- |:- |:- |
| `HotChocolate.Data.Extensions` | [![NuGet Badge](https://buildstats.info/nuget/HotChocolate.Data.Extensions)](https://www.nuget.org/packages/HotChocolate.Data.Extensions) | Combined NuGet
| `HotChocolate.Data.Filters.Extensions` | [![NuGet Badge](https://buildstats.info/nuget/HotChocolate.Data.Filters.Extensions)](https://www.nuget.org/packages/HotChocolate.Data.Filters.Extensions) | Contains only extensions for Filters## Usage "HotChocolate.Data.Filters.Extensions"
### Register in your Startup.cs
``` c#
.AddGraphQLServer()// ...
// Add filtering and sorting capabilities.
.AddExtendedFiltering() // 👈 Instead of .AddFiltering()// ...
```### Use in GraphQL
Now you can write GraphQL like this:
``` gql
query GetCharactersWithPaging1(
$take: Int
$skip: Int
$order: [ICharacterSortInput!]
) {
charactersWithPagingFilteringAndSorting(
take: $take
skip: $skip
where: { name: { containsIgnoreCase: "c" } } # 👈 instead of contains
order: $order
) {
items {
...c
}
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
}
}query GetCharactersWithPaging2(
$take: Int
$skip: Int
$order: [ICharacterSortInput!]
) {
charactersWithPagingFilteringAndSorting(
take: $take
skip: $skip
where: { name: { eqIgnoreCase: "c-3PO" } } # 👈 instead of eq
order: $order
) {
items {
...c
}
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
}
}fragment c on Character {
id
name
height
appearsIn
}
```