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

Added a new function for conditional access to db #21

Conversation

enigma-commits
Copy link

Added a new function for getting elements from KV if any of the entry is present else looking into db.

Generated SQL function for respective function.
SELECT t0.id AS res0, t0.tag AS res1, t0.location_id AS res2, t0.entity_id AS res3, t0.order AS res4, t0.version AS res5 FROM atlas_driver_offer_bpp.location_mapping AS t0 WHERE (t0.entity_id) = ('a9916d39-a7dc-4c83-b76a-9cf46445e0bf')

let findAllQueryUpdated = DB.findRows (sqlSelect ! #where_ whereClause ! defaults)
dbRes <- runQuery dbConf findAllQueryUpdated
case dbRes of
Right dbRows -> pure $ Right $ matchedKVLiveRows ++ getUniqueDBRes dbRows (snd kvRows)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why returning KVrows after doing DB call?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@enigma-commits enigma-commits force-pushed the EulerHd/New-function-for-fetching-entries-from-kv-only-with-conditional-db branch from 7287d3e to c20fc31 Compare October 16, 2023 15:32
Right kvRows -> do
let matchedKVLiveRows = findAllMatching whereClause (fst kvRows)
matchedKVRowsLength = length matchedKVLiveRows
if matchedKVRowsLength >= 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use null function rather than length

@enigma-commits enigma-commits force-pushed the EulerHd/New-function-for-fetching-entries-from-kv-only-with-conditional-db branch from c20fc31 to ec345c8 Compare October 17, 2023 06:54
@aravindgopall aravindgopall merged commit a3ea4d2 into juspay:ag/open-source Oct 17, 2023
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

Successfully merging this pull request may close these issues.

2 participants