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

Allow filter with join #72

Closed
myguidingstar opened this issue Apr 2, 2018 · 3 comments
Closed

Allow filter with join #72

myguidingstar opened this issue Apr 2, 2018 · 3 comments

Comments

@myguidingstar
Copy link
Contributor

myguidingstar commented Apr 2, 2018

currently only current entity's columns are allowed in filters
There should be :join-filters and :extra-join-filters to provide constraints about join's properties.

{[(:person/all {:filters      {:person/number [:> 0]}
                :join-filters {:person/pets {:pet/yob [:> 1999]}}})]
 [:person/name :person/yob]}
SELECT `person`.`name` AS `person/name`, `person`.`yob` AS `person/yob`
FROM `person`
WHERE
(`person`.`number` IN (SELECT `person_pet`.`person_number`
                      FROM `person_pet` JOIN `pet` ON `person_pet`.`pet_index` = `pet`.`index`
                      WHERE `pet`.`yob` > 1999))
AND
(`person`.`number` > 0)

should make use of #22

@myguidingstar
Copy link
Contributor Author

myguidingstar commented Apr 9, 2018

should not separate join-filters from filters, instead allow join filters as a new kind of filters so they can be combined freely (with and, or)

@myguidingstar
Copy link
Contributor Author

the above example becomes:

{[(:person/all {:filters {;; in-table filter
                          :person/number [:> 0]
                          ;; join filter
                          :person/pets {:pet/yob [:> 1999]}}})]
 [:person/name :person/yob]}

@myguidingstar
Copy link
Contributor Author

myguidingstar commented Apr 9, 2018

  • extract the function that generates the above sub query (the SELECT inside an IN)
    • should also have sql query and params separated
  • modify the filter spec to include join filters
  • modify the WHERE emitter to include params introduced by sub queries

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