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

Dynamic queries: add support for predicates in WHERE clauses #41

Open
jschaf opened this issue Sep 20, 2021 · 0 comments
Open

Dynamic queries: add support for predicates in WHERE clauses #41

jschaf opened this issue Sep 20, 2021 · 0 comments

Comments

@jschaf
Copy link
Owner

jschaf commented Sep 20, 2021

Use case is to enable queries with dynamic expressions for WHERE clauses, like:

SELECT *
FROM foo
WHERE pggen.predicate('filter_expr')

Sketch:

  • Generated Go code takes a FilterExpr function that returns (string, error), maybe implementing a generic interface so it's easy to wrap existing Go SQL codegen.
  • If we implement an interface, we should move it to a different library so folks don't have to depend on the relatively heavyweight dependencies of pggen, namely Docker.
  • pggen calls FilterExpr and injects code as-is into the query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant