Skip to content
Discussion options

You must be logged in to vote

It depends how tied you are to the view. Views don't take parameters; you'll want a function for that.

If you don't really need the view, you could write the query directly; it'd look something like this:

query {
  events_aggregate(
    where: {
      _and: [
        {start_at: {_gte: "2022-01-01"}},
        {start_at: {_lt: "2022-02-01"}}
      ]
    }
  ) {
    aggregate {
      count
    }
  }
}

This uses the comparison operators _gte for >= and _lt for <.

If you really this to be encoded in the database itself, I recommend using a function, and then calling that function from Hasura, or using a native query.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by amitava82
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants