Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing arguments to functions as filters #153

Open
scottgonzalez opened this issue Apr 22, 2021 · 2 comments
Open

Support passing arguments to functions as filters #153

scottgonzalez opened this issue Apr 22, 2021 · 2 comments

Comments

@scottgonzalez
Copy link

Computed columns support functions and will expose the new field as a filter as long as there are no required arguments. Providing defaults for the arguments will allow the function to be used as a filter, but it is not currently possible to provide a value to use in place of the defaults. Would you be willing to support a new property, alongside the operators, which would take an object containing the arguments to pass to the function?

Given the example in #110, this would allow a filter like:

filter: {
  distance_from: {
    lessThan: 300
    args: {
      origin_lat: 51.111
      origin_lng: -7.123123
    }
  }
}
@ltamrazov
Copy link

+1 This would help us as well quite a bit. It would eliminate the need for running several plugins (currently we might need: https://github.com/RoadRunnerEngineering/postgraphile-plugin-custom-filter to accommodate this).

@mattbretl
Copy link
Member

👍 I can see that being useful. I don't have the bandwidth to tackle this right now, but would definitely welcome a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants