Support of aggregate function in GraphQL -


i'm interested graphql analytic solution (think of webapp displaying graphs). cannot find examples of graphql using aggregate function. main aspect of of queries done frontend.

for solution, have 3 typical backend calls.

  1. search
  2. aggregate
  3. time series

let have type specified in graphql

type person {   name: string   age: int   create_time: date } 
  1. search

this seems handled graphql. no question here.

ex. search age of person named bob { person(name: "bob") { age } }

  1. aggregate

this typical case want display info in pie chart. let want count number of person age.

here postgresql query:

select age, count(*) ticket group age; 

what equivalent in graphql?

  1. time series typical case want display info in barchart x axis time.

ex. let want count number of created user per hour.

here postgresql query:

select date_trunc('hour', create_time) create_time_bin, count(*) person group create_time_bin order create_time_bin asc; 

what graphql equivalent query?

graphql, @ end of day, responds defined types. need put data type. whether specific type these different queries, or fields data on existing types, it's that's boils down to. graphql require more effort front in terms of defining types , queries return, makes more rigid, idea on other side of lies cool features, introspection , type checking. if doesn't seem make logical sense put sort of "ad hoc" data structures graphql type, it's not illegal have non-graphql endpoints if need other data sources.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -