Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Q syntax (db :: (* -> *) -> *) s a
- type QExpr = QGenExpr QValueContext
- newtype QGenExpr context syntax s t = QExpr (TablePrefix -> syntax)
- type family QExprToIdentity x
- type family QExprToField x
- data QWindow syntax s
- type QWindowFrame = QGenExpr QWindowFrameContext
- type Projectible = ProjectibleWithPredicate AnyType
- data Aggregation syntax s a
- class IsSql92SelectSyntax selectSyntax => HasQBuilder selectSyntax where
Documentation
data Q syntax (db :: (* -> *) -> *) s a Source #
The type of queries over the database db
returning results of type a
.
The s
argument is a threading argument meant to restrict cross-usage of
QExpr
s. syntax
represents the SQL syntax that this query is building.
Instances
Monad (Q syntax db s) Source # | |
Functor (Q syntax db s) Source # | |
Applicative (Q syntax db s) Source # | |
Defined in Database.Beam.Query.Internal pure :: a -> Q syntax db s a # (<*>) :: Q syntax db s (a -> b) -> Q syntax db s a -> Q syntax db s b # liftA2 :: (a -> b -> c) -> Q syntax db s a -> Q syntax db s b -> Q syntax db s c # (*>) :: Q syntax db s a -> Q syntax db s b -> Q syntax db s b # (<*) :: Q syntax db s a -> Q syntax db s b -> Q syntax db s a # |
newtype QGenExpr context syntax s t Source #
The type of lifted beam expressions that will yield the haskell type t
.
context
is a type-level representation of the types of expressions this
can contain. For example, QAggregateContext
represents expressions that
may contain aggregates, and QWindowingContext
represents expressions that
may contain OVER
.
syntax
is the expression syntax being built (usually a type that
implements IsSql92ExpressionSyntax
at least, but not always).
s
is a state threading parameter that prevents QExpr
s from incompatible
sources to be combined. For example, this is used to prevent monadic joins
from depending on the result of previous joins (so-called LATERAL
joins).
QExpr (TablePrefix -> syntax) |
Instances
(Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate syntax (t (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Internal | |
(Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate syntax (t (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy contextPredicate -> (forall context0. contextPredicate context0 => Proxy context0 -> WithExprContext syntax -> m (WithExprContext syntax)) -> t (QGenExpr context syntax s) -> m (t (QGenExpr context syntax s)) Source # | |
contextPredicate context => ProjectibleWithPredicate contextPredicate syntax (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy contextPredicate -> (forall context0. contextPredicate context0 => Proxy context0 -> WithExprContext syntax -> m (WithExprContext syntax)) -> QGenExpr context syntax s a -> m (QGenExpr context syntax s a) Source # | |
Beamable tbl => ThreadRewritable s (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Internal rewriteThread :: Proxy s' -> tbl (Nullable (QGenExpr ctxt syntax s)) -> WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Beamable tbl => ThreadRewritable s (tbl (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) :: * Source # rewriteThread :: Proxy s' -> tbl (QGenExpr ctxt syntax s) -> WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable t) => SqlDeconstructMaybe syntax (t (Nullable (QGenExpr ctxt syntax s))) (t (QGenExpr ctxt syntax s)) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (t (QGenExpr ctxt syntax s) -> QGenExpr ctxt0 syntax s y) -> t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s y Source # | |
SqlOrderable syntax (QOrd syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators makeSQLOrdering :: QOrd syntax s a -> [WithExprContext syntax] | |
ThreadRewritable s (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) :: * Source # rewriteThread :: Proxy s' -> QGenExpr ctxt syntax s a -> WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # | |
IsSql92ExpressionSyntax syntax => SqlDeconstructMaybe syntax (QGenExpr ctxt syntax s (Maybe x)) (QGenExpr ctxt syntax s x) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (QGenExpr ctxt syntax s x -> QGenExpr ctxt0 syntax s y) -> QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s y Source # | |
Beamable tbl => ContextRewritable (tbl (Nullable (QGenExpr old syntax s))) Source # | |
Defined in Database.Beam.Query.Internal rewriteContext :: Proxy ctxt -> tbl (Nullable (QGenExpr old syntax s)) -> WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # | |
Beamable tbl => ContextRewritable (tbl (QGenExpr old syntax s)) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt :: * Source # rewriteContext :: Proxy ctxt -> tbl (QGenExpr old syntax s) -> WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # | |
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Combinators | |
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (t (QExpr syntax s)) (t (Nullable (QExpr syntax s))) Source # | |
Beamable tbl => QGroupable (tbl (QExpr expr s)) (tbl (QGroupExpr expr s)) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: tbl (QExpr expr s) -> tbl (QGroupExpr expr s) Source # | |
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (PrimaryKey t (QExpr syntax s)) (PrimaryKey t (Nullable (QExpr syntax s))) Source # | |
Defined in Database.Beam.Query.Combinators just_ :: PrimaryKey t (QExpr syntax s) -> PrimaryKey t (Nullable (QExpr syntax s)) Source # nothing_ :: PrimaryKey t (Nullable (QExpr syntax s)) Source # | |
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Ord (==.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (QGenExpr context syntax s)) Source # | Compare two arbitrary |
Defined in Database.Beam.Query.Ord (==.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (QExpr syntax s a) (QExpr syntax s (Maybe a)) Source # | |
QGroupable (QExpr expr s a) (QGroupExpr expr s a) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: QExpr expr s a -> QGroupExpr expr s a Source # | |
IsSql92ExpressionSyntax syntax => SqlOrdQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (<=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlQuantifiedEqualityCheck syntax a) => SqlEqQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | Two arbitrary expressions can be quantifiably compared for equality. |
Defined in Database.Beam.Query.Ord | |
Retaggable (QGenExpr ctxt expr s) (QGenExpr ctxt expr s t) Source # | |
IsSql92ExpressionSyntax syntax => SqlOrd (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (<=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlEqualityCheck syntax a) => SqlEq (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | Compare two arbitrary expressions (of the same type) for equality |
Defined in Database.Beam.Query.Ord (==.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (/=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (==?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # (/=?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # | |
Eq syntax => Eq (QGenExpr context syntax s t) Source # | |
(Fractional a, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a) => Fractional (QGenExpr context syntax s a) Source # | |
(Num a, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a) => Num (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Internal (+) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # (-) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # (*) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # negate :: QGenExpr context syntax s a -> QGenExpr context syntax s a # abs :: QGenExpr context syntax s a -> QGenExpr context syntax s a # signum :: QGenExpr context syntax s a -> QGenExpr context syntax s a # fromInteger :: Integer -> QGenExpr context syntax s a # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) [Char]) => IsString (QGenExpr context syntax s Text) Source # | |
Defined in Database.Beam.Query.Internal fromString :: String -> QGenExpr context syntax s Text # | |
ContextRewritable (QGenExpr old syntax s a) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (QGenExpr old syntax s a) ctxt :: * Source # rewriteContext :: Proxy ctxt -> QGenExpr old syntax s a -> WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # | |
(HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a, IsSql92ExpressionSyntax syntax) => SqlValable (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) = tbl (Nullable (QGenExpr ctxt syntax s')) | |
type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Internal | |
type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Internal | |
type Retag tag (QGenExpr ctxt expr s t) Source # | |
Defined in Database.Beam.Query.Internal | |
type QExprToField (table (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToField (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToIdentity (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Types | |
type HaskellLiteralForQExpr (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt = tbl (Nullable (QGenExpr ctxt syntax s)) | |
type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # | |
Defined in Database.Beam.Query.Internal | |
type QExprToField (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToIdentity (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Types | |
type HaskellLiteralForQExpr (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # | |
Defined in Database.Beam.Query.Internal |
type family QExprToIdentity x Source #
Instances
type family QExprToField x Source #
Instances
data QWindow syntax s Source #
Instances
ProjectibleWithPredicate WindowFrameContext syntax (QWindow syntax s) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy WindowFrameContext -> (forall context. WindowFrameContext context => Proxy context -> WithExprContext syntax -> m (WithExprContext syntax)) -> QWindow syntax s -> m (QWindow syntax s) Source # |
data Aggregation syntax s a Source #
class IsSql92SelectSyntax selectSyntax => HasQBuilder selectSyntax where Source #
buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax selectSyntax) a => TablePrefix -> Q selectSyntax db s a -> selectSyntax Source #
Instances
HasQBuilder Select Source # | |
Defined in Database.Beam.Query.Types buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax Select) a => TablePrefix -> Q Select db s a -> Select Source # | |
HasQBuilder SqlSyntaxBuilder Source # | |
Defined in Database.Beam.Query.Types buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax SqlSyntaxBuilder) a => TablePrefix -> Q SqlSyntaxBuilder db s a -> SqlSyntaxBuilder Source # |