Git Product home page Git Product logo

Comments (5)

gmjordan avatar gmjordan commented on June 23, 2024 1

I've tested it locally and it works well. Nicely done.

from arangodb-graphql-java.

colinfindlay avatar colinfindlay commented on June 23, 2024

Hi Greg, sorry for the delayed response - I've been on vacation.

There is currently no support for sorting. The AQL query that is generated basically outputs a list of paths which is probably not particularly useful for sorting, other than perhaps the top level root vertices.

I assume by the question you are looking to sort nested relationships so something like the following pseudo-GraphQL query

{ clients { name @sort age address { line1 line2 city @sort } }

i.e. Sort Clients by name, sort each client's address by city.

Is that right?

from arangodb-graphql-java.

gmjordan avatar gmjordan commented on June 23, 2024

yes, but top level sort would cover many use cases. For example, list of accounts ordered by account # or "friendly" name on the account, e.g. checking, savings ArangoDB-Community/arangodb-graphql-spring-boot-starter#1 , savings ArangoDB-Community/arangodb-graphql-spring-boot-starter#2

it would be ideal to have this with skip and limit, also, for pagination

from arangodb-graphql-java.

colinfindlay avatar colinfindlay commented on June 23, 2024

I've pushed a commit to my fork that should handle this.

The way it should work is if you declare arguments on your query operation named,"limit", "skip", or "sort" it will handle them accordingly.

Limit and Skip have the same meaning as the AQL documentation for Limit and Skip, and should be declared as Int type. Sort can be declared as a custom input type, as long as all its properties are scalar and can represent the String "ASC" or "DESC". An enum is a good choice here I think.

Example Schema:

enum SortDirection {
    ASC,
    DESC
}

input ClientSort {
    firstName: SortDirection
    lastName: SortDirection
}

type Query {
    getClients(limit: Int, skip: Int, sort: ClientSort): [Client]
}

Example Query

query {
  getClients(limit: 1, skip: 1, sort: { lastName: ASC }) {
    firstName
    lastName
  }
}

If you think that works for your use case let me know and I will open a PR with the community repo, and update the docs.

from arangodb-graphql-java.

colinfindlay avatar colinfindlay commented on June 23, 2024

Functionality included in v1.2

from arangodb-graphql-java.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.