| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
IHP.TypedSql.Types
Synopsis
- data QueryCardinality
- data QueryExecResult
- data TypedQuery (cardinality :: QueryCardinality) (execResult :: QueryExecResult) result = TypedQuery {
- tqSnippet :: !Snippet
- tqResultDecoder :: !(Row result)
- type family TypedQueryResult (cardinality :: QueryCardinality) result where ...
- type family SqlExecTypedResult (execResult :: QueryExecResult) where ...
Documentation
data QueryCardinality Source #
What the SQL parser can prove about how many rows a query returns.
Constructors
| ManyRows | |
| AtMostOneRow | |
| ExactlyOneRow |
Instances
| Show QueryCardinality Source # | |
Defined in IHP.TypedSql.Types Methods showsPrec :: Int -> QueryCardinality -> ShowS # show :: QueryCardinality -> String # showList :: [QueryCardinality] -> ShowS # | |
| Eq QueryCardinality Source # | |
Defined in IHP.TypedSql.Types Methods (==) :: QueryCardinality -> QueryCardinality -> Bool # (/=) :: QueryCardinality -> QueryCardinality -> Bool # | |
data QueryExecResult Source #
What kind of result an SQL statement has.
This marker is separate from QueryCardinality because statements without
result columns can still have different execution results: DML statements
report affected rows, while utility statements such as SET CONSTRAINTS do
not report a row count.
Constructors
| ReturnsRows | |
| ReturnsAffectedRows | |
| ReturnsNoResult |
Instances
| Show QueryExecResult Source # | |
Defined in IHP.TypedSql.Types Methods showsPrec :: Int -> QueryExecResult -> ShowS # show :: QueryExecResult -> String # showList :: [QueryExecResult] -> ShowS # | |
| Eq QueryExecResult Source # | |
Defined in IHP.TypedSql.Types Methods (==) :: QueryExecResult -> QueryExecResult -> Bool # (/=) :: QueryExecResult -> QueryExecResult -> Bool # | |
data TypedQuery (cardinality :: QueryCardinality) (execResult :: QueryExecResult) result Source #
Prepared query with a custom row parser. High-level: this is the runtime value produced by the typed SQL quasiquoter.
Constructors
| TypedQuery | |
Fields
| |
type family TypedQueryResult (cardinality :: QueryCardinality) result where ... Source #
The result shape returned by sqlQueryTyped.
Equations
| TypedQueryResult 'ManyRows result = [result] | |
| TypedQueryResult 'AtMostOneRow result = Maybe result | |
| TypedQueryResult 'ExactlyOneRow result = result |
type family SqlExecTypedResult (execResult :: QueryExecResult) where ... Source #
The result returned by sqlExecTyped.
Equations
| SqlExecTypedResult 'ReturnsAffectedRows = Int64 | |
| SqlExecTypedResult 'ReturnsNoResult = () | |
| SqlExecTypedResult 'ReturnsRows = TypeError ('Text "sqlExecTyped cannot run SQL statements that return rows. Use sqlQueryTyped instead.") :: Type |