Skip to content

Commit

Permalink
Merge pull request #34 from juspay/feature/hash
Browse files Browse the repository at this point in the history
added missing field as an input parameter to `setHash, setHashInMulti`
  • Loading branch information
iamnewspecies authored Mar 11, 2019
2 parents bc1c57e + f5bc581 commit 922e532
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"purescript-sequelize": "https://github.com/juspay/purescript-sequelize.git#0.1.2",
"purescript-body-parser": "https://github.com/juspay/purescript-body-parser.git#0.1.0",
"purescript-uuid": "^4.0.0",
"purescript-redis": "https://github.com/juspay/purescript-redis.git#0.1.2",
"purescript-redis": "https://github.com/juspay/purescript-redis.git#0.1.3",
"purescript-now": "3.0.0"
},
"devDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions src/Presto/Backend/Language/Flow.purs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ data BackendFlowCommands next st rt s =
| Fork (BackendFlow st rt s) (Unit -> next)
| Expire CacheConn String String (Either Error String -> next)
| Incr CacheConn String (Either Error String -> next)
| SetHash CacheConn String String (Either Error String -> next)
| SetHash CacheConn String String String (Either Error String -> next)
| GetHashKey CacheConn String String (Either Error String -> next)
| PublishToChannel CacheConn String String (Either Error String -> next)
| Subscribe CacheConn String (Either Error String -> next)
Expand All @@ -82,7 +82,7 @@ data BackendFlowCommands next st rt s =
| SetCacheWithExpiryInMulti Multi String String String (Multi -> next)
| ExpireInMulti Multi String String (Multi -> next)
| IncrInMulti Multi String (Multi -> next)
| SetHashInMulti Multi String String (Multi -> next)
| SetHashInMulti Multi String String String (Multi -> next)
| GetHashInMulti Multi String String (Multi -> next)
| SetWithOptionsInMulti Multi (Array String) (Multi -> next)
| PublishToChannelInMulti Multi String String (Multi -> next)
Expand Down Expand Up @@ -244,13 +244,13 @@ incr cacheName key = do
cacheConn <- getCacheConn cacheName
wrap $ Incr cacheConn key id

setHashInMulti :: forall st rt. Multi -> String -> String -> BackendFlow st rt Multi
setHashInMulti multi key value = wrap $ SetHashInMulti multi key value id
setHashInMulti :: forall st rt. Multi -> String -> String -> String -> BackendFlow st rt Multi
setHashInMulti multi key field value = wrap $ SetHashInMulti multi key field value id

setHash :: forall st rt. String -> String -> String -> BackendFlow st rt (Either Error String)
setHash cacheName key value = do
setHash :: forall st rt. String -> String -> String -> String -> BackendFlow st rt (Either Error String)
setHash cacheName key field value = do
cacheConn <- getCacheConn cacheName
wrap $ SetHash cacheConn key value id
wrap $ SetHash cacheConn key field value id

getHashKeyInMulti :: forall st rt. Multi -> String -> String -> BackendFlow st rt Multi
getHashKeyInMulti multi key field = wrap $ GetHashInMulti multi key field id
Expand Down
4 changes: 2 additions & 2 deletions src/Presto/Backend/Language/Interpreter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interpret _ (Expire cacheConn key ttl next) = (R.lift $ S.lift $ E.lift $ expire

interpret _ (Incr cacheConn key next) = (R.lift $ S.lift $ E.lift $ incr cacheConn key) >>= (pure <<< next)

interpret _ (SetHash cacheConn key value next) = (R.lift $ S.lift $ E.lift $ setHash cacheConn key value) >>= (pure <<< next)
interpret _ (SetHash cacheConn key field value next) = (R.lift $ S.lift $ E.lift $ setHash cacheConn key field value) >>= (pure <<< next)

interpret _ (GetHashKey cacheConn key field next) = (R.lift $ S.lift $ E.lift $ getHashKey cacheConn key field) >>= (pure <<< next)

Expand Down Expand Up @@ -124,7 +124,7 @@ interpret _ (ExpireInMulti multi key ttl next) = (R.lift <<< S.lift <<< E.lift <

interpret _ (IncrInMulti multi key next) = (R.lift <<< S.lift <<< E.lift <<< incrMulti key $ multi) >>= (pure <<< next)

interpret _ (SetHashInMulti multi key value next) = (R.lift <<< S.lift <<< E.lift <<< setHashMulti key value $ multi) >>= (pure <<< next )
interpret _ (SetHashInMulti multi key field value next) = (R.lift <<< S.lift <<< E.lift <<< setHashMulti key field value $ multi) >>= (pure <<< next )

interpret _ (GetHashInMulti multi key value next) = (R.lift <<< S.lift <<< E.lift <<< getHashKeyMulti key value $ multi) >>= (pure <<< next )

Expand Down

0 comments on commit 922e532

Please sign in to comment.