Skip to content

Commit

Permalink
[Cursor] add a ToField instance
Browse files Browse the repository at this point in the history
Related to haskellari#113
  • Loading branch information
CGenie committed May 10, 2023
1 parent c8cfbe4 commit 0ee3461
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Database/PostgreSQL/Simple/Cursor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ import Control.Monad (unless, void)
import Data.Monoid (mconcat)
import Database.PostgreSQL.Simple.Compat ((<>), toByteString)
import Database.PostgreSQL.Simple.FromRow (FromRow(..))
import Database.PostgreSQL.Simple.Types (Query(..))
import Database.PostgreSQL.Simple.ToField (ToField(..))
import Database.PostgreSQL.Simple.Types (Identifier(..), Query(..))
import Database.PostgreSQL.Simple.Internal as Base hiding (result, row)
import Database.PostgreSQL.Simple.Internal.PQResultUtils
import Database.PostgreSQL.Simple.Transaction
import qualified Database.PostgreSQL.LibPQ as PQ
import qualified Data.Text.Encoding as T

-- | Cursor within a transaction.
data Cursor = Cursor !Query !Connection
instance ToField Cursor where
toField (Cursor name _conn) = toField $ Identifier $ T.decodeUtf8 $ fromQuery name

-- | Declare a temporary cursor. The cursor is given a
-- unique name for the given connection.
Expand Down

0 comments on commit 0ee3461

Please sign in to comment.