-
Notifications
You must be signed in to change notification settings - Fork 0
Add cursor-based pagination with composite Page Token implementation and unified async API #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
16
commits into
main
Choose a base branch
from
copilot/add-page-token-implementation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6138eda
Initial plan
Copilot a3eb233
Add cursor-based pagination infrastructure with HasCursorKey builder …
Copilot 417c3ff
Add cursor pagination demo and comprehensive tests
Copilot 26f6f57
Add cursor pagination documentation to README
Copilot 273c935
Address code review feedback: improve error handling, add type suppor…
Copilot 4e0c18b
Reorganize cursor pagination tests to follow project naming conventions
Copilot c611f74
Fix cursor pagination to support descending sort order
Copilot 7397df4
Fix cursor pagination with non-cursor-key sorting and add comprehensi…
Copilot 9439bb3
Revert problematic cursor-key prepending and document limitations
Copilot 4c44cf4
Implement composite cursors for full sorting support in cursor pagina…
Copilot 36d548b
Optimize cursor pagination code: remove inline comments and improve p…
Copilot f4282a7
Refactor code per review: rename method, move fields to top, remove u…
Copilot 7dc2245
Address code review feedback: consolidate caches, rename method, add …
Copilot d858082
Fix static field naming convention: use s_ prefix consistently
Copilot d913919
Refactor for performance: eliminate ToList+AsQueryable, unify sorting…
Copilot 3a7287f
Refactor for performance: unify sorting logic using Expression API, e…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
19 changes: 19 additions & 0 deletions
19
sample/AutoQueryApiDemo/Configurations/UserCursorQueryConfiguration.cs
This file contains hidden or 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,19 @@ | ||
| using AutoQuery; | ||
| using AutoQuery.Abstractions; | ||
| using AutoQuery.Extensions; | ||
| using AutoQueryApiDemo.Models; | ||
|
|
||
| namespace AutoQueryApiDemo.Configurations; | ||
|
|
||
| public class UserCursorQueryConfiguration : IFilterQueryConfiguration<UserCursorQueryOptions, User> | ||
| { | ||
| public void Configure(FilterQueryBuilder<UserCursorQueryOptions, User> builder) | ||
| { | ||
| builder.HasCursorKey(d => d.Id); | ||
|
|
||
| builder.Property(q => q.FilterIds, d => d.Id) | ||
| .HasCollectionContains(); | ||
| builder.Property(q => q.FilterName, d => d.Name) | ||
| .HasEqual(); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,20 @@ | ||
| using AutoQuery.Abstractions; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace AutoQueryApiDemo.Models; | ||
|
|
||
| public class UserCursorQueryOptions : IQueryCursorOptions | ||
| { | ||
| [FromQuery(Name = "filter[ids]")] | ||
| public int[]? FilterIds { get; set; } | ||
| [FromQuery(Name = "filter[name]")] | ||
| public string? FilterName { get; set; } | ||
| [FromQuery(Name = "fields")] | ||
| public string? Fields { get; set; } | ||
| [FromQuery(Name = "sort")] | ||
| public string? Sort { get; set; } | ||
| [FromQuery(Name = "pageToken")] | ||
| public string? PageToken { get; set; } | ||
| [FromQuery(Name = "pageSize")] | ||
| public int? PageSize { get; set; } | ||
| } |
This file contains hidden or 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,17 @@ | ||
| namespace AutoQuery.Abstractions; | ||
|
|
||
| /// <summary> | ||
| /// Query parameters for cursor-based pagination. | ||
| /// </summary> | ||
| public interface IQueryCursorOptions : IQueryOptions | ||
| { | ||
| /// <summary> | ||
| /// Page token representing the cursor position for pagination. | ||
| /// </summary> | ||
| string? PageToken { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Number of items to return. | ||
| /// </summary> | ||
| int? PageSize { get; set; } | ||
| } |
This file contains hidden or 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 hidden or 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,13 @@ | ||
| namespace AutoQuery; | ||
|
|
||
| /// <summary> | ||
| /// Represents a cursor-based paginated result. | ||
| /// </summary> | ||
| /// <typeparam name="TData">The type of data contained in the result set.</typeparam> | ||
| /// <param name="Datas">The data collection of the paginated result, represented as <see cref="IQueryable{T}"/> for API consistency with other paged results.</param> | ||
| /// <param name="NextPageToken">The page token for the next page, or null if there are no more results.</param> | ||
| /// <param name="Count">The number of items in the current result set.</param> | ||
| /// <remarks> | ||
| /// Note: The data is materialized during pagination but exposed as IQueryable for consistency with <see cref="PagedResult{TData}"/>. | ||
| /// </remarks> | ||
| public record CursorPagedResult<TData>(IQueryable<TData> Datas, string? NextPageToken, int Count); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移除方法內註解
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已移除方法內註解。
Commit: f4282a7