Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarver authored Apr 24, 2024
1 parent 586f0a4 commit 493c770
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ struct PeopleArguments: GraphPaginatable {
Use pagination.

```swift
func people(context: Context, arguments: PeopleArguments) -> BasicConnection<Person> {
func people(context: Context, arguments: PeopleArguments) async throws -> BasicConnection<Person> {
// Extract offset and count from the input, and query the database.
let offsetPagination = arguments.pagination.makeOffsetPagination()
let people = try await Person.all(offset: offsetPagination.offset, count: offsetPagination.count)
// Create a connection data structure converting people into edges with index-based cursors.
let people = try await Person.all(
offset: offsetPagination.offset,
count: offsetPagination.count
)
// Create a connection data structure converting people into edges
// with index-based cursors.
return BasicConnection(
nodes: people,
pagination: arguments.pagination,
Expand Down

0 comments on commit 493c770

Please sign in to comment.