sourcenetwork / defradb

DefraDB is a Peer-to-Peer Edge Database. It's the core data storage system for the Source Network Ecosystem, built with IPLD, LibP2P, CRDTs, and Semantic open web properties.
452 stars 46 forks source link

Order by aggregated values #2950

Open fredcarle opened 2 months ago

fredcarle commented 2 months ago
type User {
  name: String
  books: Int
  dvds: Int
  posters: Int
}

It would be useful for example to aggregate the stats and order by that aggregated value.

query {
   User(order: {total: DESC}) {
    total: _sum(books, dvds, posters)
  }
}

Given GQL specs, we may need to do something like this for GQL client to support it:

query {
   User(order: {_alias("total"): DESC}) {
    total: _sum(books, dvds, posters)
  }
}
AndrewSisley commented 2 months ago

This is part/a-duplicate of https://github.com/sourcenetwork/defradb/issues/681