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

Make the whole read-map be dynamic #8

Open
petterik opened this issue Mar 27, 2018 · 1 comment
Open

Make the whole read-map be dynamic #8

petterik opened this issue Mar 27, 2018 · 1 comment

Comments

@petterik
Copy link
Owner

petterik commented Mar 27, 2018

Let the values of the lajt-reads be a function taking the env. Right now it's defined as maps everywhere. Example where the query changes depending on params:

(defmethod lajt-read :query/store-items
  [_]
  (fn [env]
    (merge-with merge
                {:remote true
                 :query  {:find '[[?e ...]]}}
                (if (seq (get-in env [:route-params :navigation]))
                  {:query  '{:where [[?s :store/items ?e]
                                     [?e :store.item/section ?n]
                                     [?n :store.section/path ?p]
                                     [?e :store.item/name _]]}
                   :params {'?s [:route-params :store-id]
                            '?p [:route-params :navigation]}}
                  {:query  '{:where [[?s :store/items ?e]
                                     [?e :store.item/name _]]}
                   :params {'?s [:route-params :store-id]}}))))
@petterik
Copy link
Owner Author

Unsure how important this is when there'll be ways to expand the queries with data such as #9

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

1 participant