Skip to content

Instantly share code, notes, and snippets.

@owenallenaz
Last active January 18, 2019 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owenallenaz/48278400e3ac3e5e6e0a5cbf522bd078 to your computer and use it in GitHub Desktop.
Save owenallenaz/48278400e3ac3e5e6e0a5cbf522bd078 to your computer and use it in GitHub Desktop.
GraphQL sorting

Right now most queries are

table(filter: {}, paging : { limit : x, skip : x })

Do we rename paging to options, and put sort inside?

users(filter: {}, options: { limit : x, skip : x, sort : x })

Do we keep paging and make sort a sibling

users(filter: {}, paging : {}, sort : [{ field : "x", order : "asc" }]

Then, what is the shape of the sort key. Do we explicitly expose available sorts. This allows us to tightly control what sorts are exposed ensuring that they can be performant.

enum auth_roles_sort {
  title_desc
}

sort : title_desc

Or do we allow arbitrary sorts, more powerful, won't require core to add more sort capabilities, but can be less performant over time, since we can't guarantee which sorts are being utilized.

sort : [{ field : "title", dir : "asc" }]

Or some combination in between?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment