Skip to content

Commit bec4e00

Browse files
committed
readme
1 parent 14a756e commit bec4e00

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GoatQuery
22

3-
A .NET library for parsing OData-style query parameters into LINQ expressions. Enables database-level filtering, sorting, and pagination from HTTP query strings.
3+
A .NET library for parsing query parameters into LINQ expressions. Enables database-level filtering, sorting, and pagination from HTTP query strings.
44

55
## Installation
66

@@ -27,19 +27,21 @@ public IActionResult GetUsers() => Ok(dbContext.Users);
2727

2828
```
2929
GET /api/users?$filter=age gt 18 and isActive eq true
30-
GET /api/users?$orderby=lastName asc, firstName desc
30+
GET /api/users?$orderby=lastName asc, firstName desc
3131
GET /api/users?$top=10&$skip=20&$count=true
3232
GET /api/users?$search=john
3333
```
3434

3535
## Filtering
3636

3737
### Operators
38+
3839
- **Comparison**: `eq`, `ne`, `gt`, `ge`, `lt`, `le`
3940
- **Logical**: `and`, `or`
4041
- **String**: `contains`
4142

4243
### Data Types
44+
4345
- String: `'value'`
4446
- Numbers: `42`, `3.14f`, `2.5m`, `1.0d`
4547
- Boolean: `true`, `false`
@@ -48,6 +50,7 @@ GET /api/users?$search=john
4850
- Null: `null`
4951

5052
### Examples
53+
5154
```csharp
5255
"age gt 18"
5356
"firstName eq 'John' and isActive ne false"
@@ -64,7 +67,7 @@ public class UserDto
6467
{
6568
[JsonPropertyName("first_name")]
6669
public string FirstName { get; set; }
67-
70+
6871
public int Age { get; set; } // Maps to "age"
6972
}
7073
```
@@ -79,7 +82,7 @@ Implement custom search logic:
7982
public class UserSearchBinder : ISearchBinder<User>
8083
{
8184
public Expression<Func<User, bool>> Bind(string searchTerm) =>
82-
user => user.FirstName.Contains(searchTerm) ||
85+
user => user.FirstName.Contains(searchTerm) ||
8386
user.LastName.Contains(searchTerm);
8487
}
8588

@@ -89,13 +92,15 @@ var result = users.Apply(query, new UserSearchBinder());
8992
## ASP.NET Core Integration
9093

9194
### Action Filter
95+
9296
```csharp
9397
[HttpGet]
9498
[EnableQuery<UserDto>(maxTop: 100)]
9599
public IActionResult GetUsers() => Ok(dbContext.Users);
96100
```
97101

98102
### Manual Processing
103+
99104
```csharp
100105
[HttpGet]
101106
public IActionResult GetUsers([FromQuery] Query query)
@@ -126,4 +131,4 @@ dotnet build --configuration Release
126131
cd example && dotnet run
127132
```
128133

129-
**Targets**: .NET Standard 2.0/2.1, .NET 6.0+
134+
**Targets**: .NET Standard 2.0/2.1, .NET 6.0+

0 commit comments

Comments
 (0)