Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type TypeCache = IORef (HashMap Text Oid)
- data Connection = Connection {}
- connectdbSharedCache :: ByteString -> IO Connection
- connectdbNewCache :: ByteString -> IO Connection
- finish :: Connection -> IO ()
- globalCache :: TypeCache
- queryWith :: KnownNat (Width r) => RowEncoder p -> RowDecoder (Width r) r -> Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r))
- queryWith_ :: RowEncoder p -> Connection -> Query n -> p -> IO (Either QueryError ())
- query :: (ToSql p, FromSql r, KnownNat (Width r)) => Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r))
- query_ :: ToSql p => Connection -> Query n -> p -> IO (Either QueryError ())
- execParams :: RowEncoder p -> Connection -> ByteString -> p -> IO (Either QueryError Result)
- connectionError :: Connection -> Maybe a -> IO (Either Text a)
- decodeVector :: KnownNat n => Connection -> RowDecoder n a -> Result -> IO (Either QueryError (Vector a))
- lookupType :: Connection -> PgType -> IO LookupResult
- data LookupResult
- lookupTypeIgnoreCache :: Connection -> PgType -> IO (Either QueryError Oid)
- data IsolationLevel
- begin :: Connection -> IsolationLevel -> IO (Either QueryError ())
- commit :: Connection -> IO (Either QueryError ())
- rollback :: Connection -> IO (Either QueryError ())
Documentation
data Connection Source #
We make the type cache part of the Connection to offer the option of
per-Connection (or striped) caches. It's also reasonable to share a single
cache for an entire multi-threaded program; the IORef
supports this usage.
Instances
SQL (ReaderT Connection IO) Source # | Most larger applications will define an instance; this one is suitable to test out the library.
A safer version would use |
Defined in Preql.Effect runTransaction' :: IsolationLevel -> Transaction a -> ReaderT Connection IO a Source # withConnection :: (Connection -> ReaderT Connection IO a) -> ReaderT Connection IO a Source # queryOn :: (ToSql p, FromSql r, KnownNat (Width r)) => Connection -> (Query (Width r), p) -> ReaderT Connection IO (Vector r) Source # queryOn_ :: ToSql p => Connection -> (Query 0, p) -> ReaderT Connection IO () Source # |
finish :: Connection -> IO () Source #
queryWith :: KnownNat (Width r) => RowEncoder p -> RowDecoder (Width r) r -> Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r)) Source #
queryWith_ :: RowEncoder p -> Connection -> Query n -> p -> IO (Either QueryError ()) Source #
query :: (ToSql p, FromSql r, KnownNat (Width r)) => Connection -> Query (Width r) -> p -> IO (Either QueryError (Vector r)) Source #
query_ :: ToSql p => Connection -> Query n -> p -> IO (Either QueryError ()) Source #
execParams :: RowEncoder p -> Connection -> ByteString -> p -> IO (Either QueryError Result) Source #
connectionError :: Connection -> Maybe a -> IO (Either Text a) Source #
decodeVector :: KnownNat n => Connection -> RowDecoder n a -> Result -> IO (Either QueryError (Vector a)) Source #
lookupType :: Connection -> PgType -> IO LookupResult Source #
lookupTypeIgnoreCache :: Connection -> PgType -> IO (Either QueryError Oid) Source #
data IsolationLevel Source #
Instances
begin :: Connection -> IsolationLevel -> IO (Either QueryError ()) Source #
commit :: Connection -> IO (Either QueryError ()) Source #
rollback :: Connection -> IO (Either QueryError ()) Source #