postgresql-lo-stream-0.1.1.1: Utilities for streaming PostgreSQL LargeObjects

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Simple.LargeObjects.Stream

Synopsis

Documentation

newLargeObjectBS :: Connection -> ByteString -> IO Oid Source #

Given a strict ByteString, create a postgres large object and fill it with those contents.

newLargeObjectLBS :: Connection -> ByteString -> IO (Oid, Int) Source #

Given a lazy ByteString, create a postgres large object and fill it with those contents. Also returns the total length of the data written.

newLargeObjectStream :: Connection -> InputStream ByteString -> IO (Oid, Int) Source #

Create a new large object from an input stream, returning its object id and overall size.

withLargeObject :: Connection -> Oid -> IOMode -> (LoFd -> IO a) -> IO a Source #

Act on a large object given by id, opening and closing the file descriptor appropriately.

streamLargeObject :: Connection -> Oid -> OutputStream Builder -> IO () Source #

Stream the contents of a database large object to the given output stream. Useful with Snap's addToOutput.

streamLargeObjectRange :: Connection -> Oid -> Int -> Int -> OutputStream Builder -> IO () Source #

Stream the contents of a database large object to the given output stream. Useful with Snap's addToOutput.

withLargeObjectLBS :: Connection -> Oid -> (ByteString -> IO ()) -> IO () Source #

Act on the contents of a LargeObject as a Lazy ByteString