Advertisement
NLinker

Postgresql-simple getRaw

Jul 13th, 2017
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data Entity = Entity
  2.     { userId   :: UUID
  3.     , settings :: A.Value
  4.     } deriving (Show, Eq)
  5.  
  6. instance FromRow Entity where
  7.   fromRow = Entity <$> field <*> field
  8.  
  9. getRaw :: IO [(UUID, A.Value)]
  10. getRaw = do
  11.   let p = fromJust $ ext ^. pool
  12.   withResource p $ \conn ->
  13.     query conn q ()
  14.   where q = "SELECT user_uuid, settings FROM user_settings;"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement