Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Recursiveness be where
-
newtype
With
be (db :: (
Type
->
Type
) ->
Type
) a =
With
{
- runWith :: WriterT ( Recursiveness be, [ BeamSql99BackendCTESyntax be]) ( State Int ) a
- data QAnyScope
- data ReusableQ be db res where
- reusableForCTE :: forall be res db. ( ThreadRewritable QAnyScope res, Projectible be res, BeamSqlBackend be) => Text -> ReusableQ be db res
- selecting :: forall res be db. ( BeamSql99CommonTableExpressionBackend be, HasQBuilder be, Projectible be res, ThreadRewritable QAnyScope res) => Q be db QAnyScope res -> With be db ( ReusableQ be db res)
- reuse :: forall s be db res. ReusableQ be db res -> Q be db s ( WithRewrittenThread QAnyScope s res)
Documentation
data Recursiveness be where Source #
Nonrecursive :: Recursiveness be | |
Recursive :: IsSql99RecursiveCommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be) => Recursiveness be |
Instances
Semigroup ( Recursiveness be) Source # | |
Defined in Database.Beam.Query.CTE (<>) :: Recursiveness be -> Recursiveness be -> Recursiveness be Source # sconcat :: NonEmpty ( Recursiveness be) -> Recursiveness be Source # stimes :: Integral b => b -> Recursiveness be -> Recursiveness be Source # |
|
Monoid ( Recursiveness be) Source # | |
Defined in Database.Beam.Query.CTE mempty :: Recursiveness be Source # mappend :: Recursiveness be -> Recursiveness be -> Recursiveness be Source # mconcat :: [ Recursiveness be] -> Recursiveness be Source # |
newtype With be (db :: ( Type -> Type ) -> Type ) a Source #
Monad in which
SELECT
statements can be made (via
selecting
)
and bound to result names for re-use later. This has the advantage
of only computing each result once. In SQL, this is translated to a
common table expression.
Once introduced, results can be re-used in future queries with
reuse
.
With
is also a member of
MonadFix
for backends that support
recursive CTEs. In this case, you can use
mdo
or
rec
notation
(with
RecursiveDo
enabled) to bind result values (again, using
reuse
) even
before
they're introduced.
See further documentation here .
With | |
|
Instances
Monad ( With be db) Source # | |
Functor ( With be db) Source # | |
IsSql99RecursiveCommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be) => MonadFix ( With be db) Source # | |
Applicative ( With be db) Source # | |
Defined in Database.Beam.Query.CTE pure :: a -> With be db a Source # (<*>) :: With be db (a -> b) -> With be db a -> With be db b Source # liftA2 :: (a -> b -> c) -> With be db a -> With be db b -> With be db c Source # (*>) :: With be db a -> With be db b -> With be db b Source # (<*) :: With be db a -> With be db b -> With be db a Source # |
reusableForCTE :: forall be res db. ( ThreadRewritable QAnyScope res, Projectible be res, BeamSqlBackend be) => Text -> ReusableQ be db res Source #
selecting :: forall res be db. ( BeamSql99CommonTableExpressionBackend be, HasQBuilder be, Projectible be res, ThreadRewritable QAnyScope res) => Q be db QAnyScope res -> With be db ( ReusableQ be db res) Source #
Introduce the result of a query as a result in a common table
expression. The returned value can be used in future queries by
applying
reuse
.