summaryrefslogtreecommitdiff
path: root/fig-frontend/src/Fig/Frontend/DB.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-03-01 22:52:43 -0500
committerLLLL Colonq <llll@colonq>2024-03-01 22:52:43 -0500
commit7aa60d33eff21ccdaa31ccd5dd64196990bb3dea (patch)
tree516bbac3c84c171cd364672d7c15ca320839c5e2 /fig-frontend/src/Fig/Frontend/DB.hs
parent88e2726fc1fc6cec2b9e63526ce4c0a1a04a2e98 (diff)
Add test redeem message bus functionality
Diffstat (limited to 'fig-frontend/src/Fig/Frontend/DB.hs')
-rw-r--r--fig-frontend/src/Fig/Frontend/DB.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/fig-frontend/src/Fig/Frontend/DB.hs b/fig-frontend/src/Fig/Frontend/DB.hs
index 5ca8772..bcf00f2 100644
--- a/fig-frontend/src/Fig/Frontend/DB.hs
+++ b/fig-frontend/src/Fig/Frontend/DB.hs
@@ -44,3 +44,12 @@ sismember c key skey = liftIO $ Redis.runRedis c do
Redis.sismember key skey >>= hush >>> \case
Just x -> pure x
Nothing -> pure False
+
+lpop :: MonadIO m => Redis.Connection -> ByteString -> m (Maybe ByteString)
+lpop c key = liftIO $ Redis.runRedis c do
+ join . hush <$> Redis.lpop key
+
+rpush :: MonadIO m => Redis.Connection -> ByteString -> ByteString -> m ()
+rpush c key val = liftIO $ Redis.runRedis c do
+ _ <- Redis.rpush key [val]
+ pure ()