amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Use sortField (& limit) with new @connection syntax

Open FemkeBuijs opened this issue 6 years ago • 5 comments

Which Category is your question related to?

GraphQL @connection

Amplify CLI Version

4.13.0

What AWS Services are you utilizing?

DynamoDB, Amplify Console, AppSync, Cognito, SES

Question

In the docs, using the 'old, alternative' way, you can add a sortField to a GraphQL connection, like so:

directive @connection(name: String, keyField: String, sortField: String, limit: Int) on FIELD_DEFINITION

However, I cannot find a way to do that with the new syntax:

directive @connection(keyName: String, fields: [String!]) on FIELD_DEFINITION

And what about the limit?

Thank you for any help!

FemkeBuijs avatar Jan 24 '20 09:01 FemkeBuijs

Closing this is as a duplicate of #1703. Please follow that thread for updates.

SwaySway avatar Feb 03 '20 17:02 SwaySway

@SwaySway thanks i will follow that issue regarding the limit. However, issue #1703 does not address the sortField.

FemkeBuijs avatar Feb 04 '20 08:02 FemkeBuijs

@SwaySway - please re-open. As @FemkeBuijs states, the sortField issue is not addressed in the linked issue.

thomasklein-winemaker avatar Aug 07 '20 12:08 thomasklein-winemaker

@thomasklein-winemaker sortField is controlled by the @key directive with the new syntax. The first field is the partition key, and the other fields are concatenated to make up the sort key. By default the @connection will scan forward based on the sort field.

RossWilliams avatar Aug 07 '20 21:08 RossWilliams

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 00:05 github-actions[bot]