Comments (5)
I found one here:
enum UserOrderByInput {
# ascending and descending for all non-list scalar fields
}
query { users(orderBy: UserOrderByInput): [User!]}
query { users(orderBy: NAME_ASC) {name}}
I don't know if I'm a fan of NAME_ASC
though? What about { name : 1 }
or { name: -1 }
like in Mongo?
from opencrud.
The naming fieldName_ASC
is concise and consistant with other parts of OpenCRUD like filtering.
There is an issue if we need to sort on several fields or on a field from a relation.
Proposition : orderBy
could accept a list of fields:
query { users(orderBy: [UserOrderByInput] ): [User!]}
query { users(orderBy: [role_ASC, name_DESC] ) {name}}
query {
user(login:"GromNaN") {
issues(first:100, orderBy:{field:COMMENTS, direction:ASC}) {
edges {
node {
id
title
}
}
}
}
}
from opencrud.
Could the orderBy
input type be a union, like this?
orderBy: UserOrderByInput! | [UserOrderByInput!]!
Assuming GraphiQL and other tools handle this right, they would still provide auto-completion for orderBy
this way, especially in cases where only one attribute is needed.
from opencrud.
Input type be a union is not supported (yet). graphql/graphql-spec#488
from opencrud.
While GraphQL does not support union input types, a single input element is actually coerced into a single item list, so in this case we don't need a union type :-) See: prisma/prisma#95 (comment)
from opencrud.
Related Issues (20)
- @relation
- Link to GitHub
- 404 to CRUD link
- Naming Questions: Multi, Where, Data
- Pagination HOT 1
- Full-text search HOT 2
- Directive handling
- Hasura (https://hasura.io)
- Tutorial: Designing a GraphQL API [Link]
- Consider compositional WhereInput's for scalars.
- Links are not working
- Why not use required arrays with non-null items?
- OpenCRUD Roadmap?
- JSONB
- Plural and convention for other language than english
- GraphQL - error actualizar un campo
- Plural query name HOT 5
- Single mutation arguments? HOT 8
- Deleting fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencrud.