mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-29 13:33:03 +03:00
Accomodate to the RC6 backend API
This commit is contained in:
parent
45becba225
commit
89b92bdfa0
@ -24,7 +24,7 @@ module Hasql
|
||||
unit,
|
||||
count,
|
||||
single,
|
||||
vector,
|
||||
list,
|
||||
stream,
|
||||
|
||||
-- * Results Stream
|
||||
@ -249,16 +249,14 @@ count s =
|
||||
-- or an @INSERT@, which produces a generated value (e.g., an auto-incremented id).
|
||||
single :: Backend b => RowParser b r => Backend.Statement b -> Tx b s (Maybe r)
|
||||
single s =
|
||||
do
|
||||
v <- vector s
|
||||
return $ (Vector.!?) v 0
|
||||
headMay <$> list s
|
||||
|
||||
-- |
|
||||
-- Execute a @SELECT@ statement,
|
||||
-- and produce a vector of results.
|
||||
vector :: Backend b => RowParser b r => Backend.Statement b -> Tx b s (Vector r)
|
||||
vector s =
|
||||
{-# SCC "vector" #-}
|
||||
list :: Backend b => RowParser b r => Backend.Statement b -> Tx b s [r]
|
||||
list s =
|
||||
{-# SCC "list" #-}
|
||||
Tx $ ReaderT $ \c -> do
|
||||
m <- Backend.executeAndGetMatrix s c
|
||||
traverse (either (throwIO . UnparsableRow) return . RowParser.parseRow) m
|
||||
|
Loading…
Reference in New Issue
Block a user