Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Session a
- sql :: ByteString -> Session ()
- statement :: params -> Statement params result -> Session result
- run :: Session a -> Connection -> IO (Either QueryError a)
- data QueryError = QueryError ByteString [Text] CommandError
- data CommandError
- data ResultError
- data RowError
Documentation
A batch of actions to be executed in the context of a database connection.
Instances
Monad Session Source # | |
Functor Session Source # | |
Applicative Session Source # | |
MonadIO Session Source # | |
Defined in Hasql.Private.Session | |
MonadError QueryError Session Source # | |
Defined in Hasql.Private.Session throwError :: QueryError -> Session a # catchError :: Session a -> (QueryError -> Session a) -> Session a # |
sql :: ByteString -> Session () Source #
Possibly a multi-statement query, which however cannot be parameterized or prepared, nor can any results of it be collected.
statement :: params -> Statement params result -> Session result Source #
Parameters and a specification of a parametric single-statement query to apply them to.
Execution
run :: Session a -> Connection -> IO (Either QueryError a) Source #
Executes a bunch of commands on the provided connection.
Errors
data QueryError Source #
An error during the execution of a query. Comes packed with the query template and a textual representation of the provided params.
Instances
Eq QueryError Source # | |
Defined in Hasql.Private.Errors (==) :: QueryError -> QueryError -> Bool # (/=) :: QueryError -> QueryError -> Bool # | |
Show QueryError Source # | |
Defined in Hasql.Private.Errors showsPrec :: Int -> QueryError -> ShowS # show :: QueryError -> String # showList :: [QueryError] -> ShowS # | |
Exception QueryError Source # | |
Defined in Hasql.Private.Errors toException :: QueryError -> SomeException # fromException :: SomeException -> Maybe QueryError # displayException :: QueryError -> String # | |
MonadError QueryError Session Source # | |
Defined in Hasql.Private.Session throwError :: QueryError -> Session a # catchError :: Session a -> (QueryError -> Session a) -> Session a # |
data CommandError Source #
An error of some command in the session.
ClientError (Maybe ByteString) | An error on the client-side, with a message generated by the "libpq" library. Usually indicates problems with connection. |
ResultError ResultError | Some error with a command result. |
Instances
Eq CommandError Source # | |
Defined in Hasql.Private.Errors (==) :: CommandError -> CommandError -> Bool # (/=) :: CommandError -> CommandError -> Bool # | |
Show CommandError Source # | |
Defined in Hasql.Private.Errors showsPrec :: Int -> CommandError -> ShowS # show :: CommandError -> String # showList :: [CommandError] -> ShowS # |
data ResultError Source #
An error with a command result.
ServerError ByteString ByteString (Maybe ByteString) (Maybe ByteString) | An error reported by the DB. Consists of the following: Code, message, details, hint.
|
UnexpectedResult Text | The database returned an unexpected result. Indicates an improper statement or a schema mismatch. |
RowError Int RowError | An error of the row reader, preceded by the index of the row. |
UnexpectedAmountOfRows Int | An unexpected amount of rows. |
Instances
Eq ResultError Source # | |
Defined in Hasql.Private.Errors (==) :: ResultError -> ResultError -> Bool # (/=) :: ResultError -> ResultError -> Bool # | |
Show ResultError Source # | |
Defined in Hasql.Private.Errors showsPrec :: Int -> ResultError -> ShowS # show :: ResultError -> String # showList :: [ResultError] -> ShowS # |
An error during the decoding of a specific row.
EndOfInput | Appears on the attempt to parse more columns than there are in the result. |
UnexpectedNull | Appears on the attempt to parse a |
ValueError Text | Appears when a wrong value parser is used. Comes with the error details. |