drizzle-team / drizzle-graphql

Automatically generate GraphQL schema or customizable schema config fields from Drizzle ORM schema
https://www.npmjs.com/package/drizzle-graphql
Apache License 2.0
34 stars 1 forks source link

Add aggregations? #14

Open anthonyhoegberg opened 2 weeks ago

anthonyhoegberg commented 2 weeks ago

Hello, Thank you for your hard work. Maybe it would be a good idea to add some kind of aggregation api? https://orm.drizzle.team/docs/select#aggregations

As an example: There are times when we need to count the number of rows without actually requesting the data as well (pagination, etc) https://orm.drizzle.team/learn/guides/count-rows

Could count rows etc, be implemented with the use of the existing filters using the above? That way we can execute a query and get number of items that match it without doing a more costly operation.

Sukairo-02 commented 2 weeks ago

Row count could be done by just adding the extra field to each type and then modifying query with count(*) if it is requested (no data should be requested from DB in case you didn't select columns), expect that feature very soon. As for aggregation though, I am once again powerless because of current RQB limitations, however I'm all for it the moment RQB rolls out the required functionality.

UPD: Sorry for the unintended deception, but it turned out that row count too is not supported by current version of RQB, so we'll have to wait until V2 on yet another matter.