| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Database.Beam.Query.Types
Synopsis
- data Q be (db :: (Type -> Type) -> Type) s a
- type QExpr = QGenExpr QValueContext
- newtype QGenExpr context be s t = QExpr (TablePrefix -> BeamSqlBackendExpressionSyntax be)
- type family QExprToIdentity x
- type family QExprToField x
- data QWindow be s
- type Projectible be = ProjectibleWithPredicate AnyType be (WithExprContext (BeamSqlBackendExpressionSyntax' be))
- class BeamSqlBackend be => HasQBuilder be where
- buildSqlQuery :: Projectible be a => TablePrefix -> Q be db s a -> BeamSqlBackendSelectSyntax be
Documentation
data Q be (db :: (Type -> Type) -> Type) 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
QGenExprs. syntax represents the SQL syntax that this query is building.
type QExpr = QGenExpr QValueContext Source #
QGenExprs represent expressions not containing aggregates.
newtype QGenExpr context be 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 QGenExprs 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).
Constructors
| QExpr (TablePrefix -> BeamSqlBackendExpressionSyntax be) |
Instances
| (Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (t (Nullable (QGenExpr context be s))) Source # | |
Defined in Database.Beam.Query.Internal Methods project' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> WithExprContext (BeamSqlBackendExpressionSyntax' be) -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> t (Nullable (QGenExpr context be s)) -> m (t (Nullable (QGenExpr context be s))) Source # projectSkeleton' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> m (t (Nullable (QGenExpr context be s))) Source # | |
| (Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (t (QGenExpr context be s)) Source # | |
Defined in Database.Beam.Query.Internal Methods project' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> WithExprContext (BeamSqlBackendExpressionSyntax' be) -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> t (QGenExpr context be s) -> m (t (QGenExpr context be s)) Source # projectSkeleton' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> m (t (QGenExpr context be s)) Source # | |
| contextPredicate context => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (QGenExpr context be s a) Source # | |
Defined in Database.Beam.Query.Internal Methods project' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> WithExprContext (BeamSqlBackendExpressionSyntax' be) -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> QGenExpr context be s a -> m (QGenExpr context be s a) Source # projectSkeleton' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be)) -> (forall context0. contextPredicate context0 => Proxy context0 -> Proxy be -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> m (QGenExpr context be s a) Source # | |
| Beamable tbl => ThreadRewritable s (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Internal Associated Types type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # Methods 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 Associated Types type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # Methods rewriteThread :: Proxy s' -> tbl (QGenExpr ctxt syntax s) -> WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # | |
| (BeamSqlBackend be, Beamable t) => SqlDeconstructMaybe be (t (Nullable (QGenExpr ctxt be s))) (t (QGenExpr ctxt be s)) s Source # | |
Defined in Database.Beam.Query.Combinators Methods isJust_ :: t (Nullable (QGenExpr ctxt be s)) -> QGenExpr ctxt0 be s Bool Source # isNothing_ :: t (Nullable (QGenExpr ctxt be s)) -> QGenExpr ctxt0 be s Bool Source # maybe_ :: QGenExpr ctxt0 be s y -> (t (QGenExpr ctxt be s) -> QGenExpr ctxt0 be s y) -> t (Nullable (QGenExpr ctxt be s)) -> QGenExpr ctxt0 be s y Source # | |
| (TypeError ('Text "Missing mandatory sorting order. Use either 'asc_' or 'desc_' to specify sorting order.") :: Constraint) => SqlOrderable be (QGenExpr ctx be s a) Source # | |
Defined in Database.Beam.Query.Combinators Methods makeSQLOrdering :: Proxy be -> QGenExpr ctx be s a -> [WithExprContext (BeamSqlBackendOrderingSyntax be)] | |
| ThreadRewritable s (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Internal Associated Types type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # Methods rewriteThread :: Proxy s' -> QGenExpr ctxt syntax s a -> WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # | |
| BeamSqlBackend be => SqlDeconstructMaybe be (QGenExpr ctxt be s (Maybe x)) (QGenExpr ctxt be s x) s Source # | |
Defined in Database.Beam.Query.Combinators Methods isJust_ :: QGenExpr ctxt be s (Maybe x) -> QGenExpr ctxt0 be s Bool Source # isNothing_ :: QGenExpr ctxt be s (Maybe x) -> QGenExpr ctxt0 be s Bool Source # maybe_ :: QGenExpr ctxt0 be s y -> (QGenExpr ctxt be s x -> QGenExpr ctxt0 be s y) -> QGenExpr ctxt be s (Maybe x) -> QGenExpr ctxt0 be s y Source # | |
| (Beamable table, BeamSqlBackend be, FieldsFulfillConstraintNullable (BeamSqlBackendCanSerialize be) table) => SqlValable (table (Nullable (QGenExpr ctxt be s))) Source # | |
Defined in Database.Beam.Query.Combinators | |
| (Beamable table, BeamSqlBackend be, FieldsFulfillConstraint (BeamSqlBackendCanSerialize be) table) => SqlValable (table (QGenExpr ctxt be s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
| Beamable tbl => ContextRewritable (tbl (Nullable (QGenExpr old syntax s))) Source # | |
Defined in Database.Beam.Query.Internal Associated Types type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # Methods 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 Associated Types type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # Methods rewriteContext :: Proxy ctxt -> tbl (QGenExpr old syntax s) -> WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # | |
| Beamable tbl => QGroupable (tbl (Nullable (QExpr be s))) (tbl (Nullable (QGroupExpr be s))) Source # |
|
Defined in Database.Beam.Query.Aggregate | |
| Beamable tbl => QGroupable (tbl (QExpr be s)) (tbl (QGroupExpr be s)) Source # |
|
Defined in Database.Beam.Query.Aggregate Methods group_ :: tbl (QExpr be s) -> tbl (QGroupExpr be s) Source # | |
| (Table t, BeamSqlBackend be) => SqlJustable (t (QExpr be s)) (t (Nullable (QExpr be s))) Source # | |
| (Table t, BeamSqlBackend be) => SqlJustable (PrimaryKey t (QExpr be s)) (PrimaryKey t (Nullable (QExpr be s))) Source # | |
Defined in Database.Beam.Query.Combinators Methods just_ :: PrimaryKey t (QExpr be s) -> PrimaryKey t (Nullable (QExpr be s)) Source # | |
| (BeamSqlBackend be, Beamable tbl, FieldsFulfillConstraintNullable (HasSqlEqualityCheck be) tbl) => SqlEq (QGenExpr context be s) (tbl (Nullable (QGenExpr context be s))) Source # | |
Defined in Database.Beam.Query.Ord Methods (==.) :: tbl (Nullable (QGenExpr context be s)) -> tbl (Nullable (QGenExpr context be s)) -> QGenExpr context be s Bool Source # (/=.) :: tbl (Nullable (QGenExpr context be s)) -> tbl (Nullable (QGenExpr context be s)) -> QGenExpr context be s Bool Source # (==?.) :: tbl (Nullable (QGenExpr context be s)) -> tbl (Nullable (QGenExpr context be s)) -> QGenExpr context be s SqlBool Source # (/=?.) :: tbl (Nullable (QGenExpr context be s)) -> tbl (Nullable (QGenExpr context be s)) -> QGenExpr context be s SqlBool Source # | |
| (BeamSqlBackend be, Beamable tbl, FieldsFulfillConstraint (HasSqlEqualityCheck be) tbl) => SqlEq (QGenExpr context be s) (tbl (QGenExpr context be s)) Source # | Compare two arbitrary |
Defined in Database.Beam.Query.Ord Methods (==.) :: tbl (QGenExpr context be s) -> tbl (QGenExpr context be s) -> QGenExpr context be s Bool Source # (/=.) :: tbl (QGenExpr context be s) -> tbl (QGenExpr context be s) -> QGenExpr context be s Bool Source # (==?.) :: tbl (QGenExpr context be s) -> tbl (QGenExpr context be s) -> QGenExpr context be s SqlBool Source # (/=?.) :: tbl (QGenExpr context be s) -> tbl (QGenExpr context be s) -> QGenExpr context be s SqlBool Source # | |
| (HasSqlInTable be, Beamable table) => SqlIn (QGenExpr context be s) (table (QGenExpr context be s)) Source # | |
| QGroupable (QExpr be s a) (QGroupExpr be s a) Source # |
|
Defined in Database.Beam.Query.Aggregate Methods group_ :: QExpr be s a -> QGroupExpr be s a Source # | |
| BeamSqlBackend be => SqlJustable (QExpr be s a) (QExpr be s (Maybe a)) Source # | |
| (BeamSqlBackend be, HasSqlQuantifiedEqualityCheck be a) => SqlEqQuantified (QGenExpr context be s) (QQuantified be s a) (QGenExpr context be s a) Source # | Two arbitrary expressions can be quantifiably compared for equality. |
Defined in Database.Beam.Query.Ord | |
| BeamSqlBackend be => SqlOrdQuantified (QGenExpr context be s) (QQuantified be s a) (QGenExpr context be s a) Source # | |
Defined in Database.Beam.Query.Ord Methods (<*.) :: QGenExpr context be s a -> QQuantified be s a -> QGenExpr context be s Bool Source # (>*.) :: QGenExpr context be s a -> QQuantified be s a -> QGenExpr context be s Bool Source # (<=*.) :: QGenExpr context be s a -> QQuantified be s a -> QGenExpr context be s Bool Source # (>=*.) :: QGenExpr context be s a -> QQuantified be s a -> QGenExpr context be s Bool Source # | |
| (BeamSqlBackend be, HasSqlEqualityCheck be a) => SqlEq (QGenExpr context be s) (QGenExpr context be s a) Source # | Compare two arbitrary expressions (of the same type) for equality |
Defined in Database.Beam.Query.Ord Methods (==.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # (/=.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # (==?.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s SqlBool Source # (/=?.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s SqlBool Source # | |
| BeamSqlBackend be => SqlIn (QGenExpr context be s) (QGenExpr context be s a) Source # | |
| BeamSqlBackend be => SqlOrd (QGenExpr context be s) (QGenExpr context be s a) Source # | |
Defined in Database.Beam.Query.Ord Methods (<.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # (>.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # (<=.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # (>=.) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s Bool Source # | |
| Retaggable (QGenExpr ctxt expr s) (QGenExpr ctxt expr s t) Source # | |
Defined in Database.Beam.Query.Internal | |
| (BeamSqlBackend backend, BeamSqlBackendCanSerialize backend [Char]) => IsString (QGenExpr context backend s Text) Source # | |
Defined in Database.Beam.Query.Internal Methods fromString :: String -> QGenExpr context backend s Text # | |
| (Num a, BeamSqlBackend be, BeamSqlBackendCanSerialize be a) => Num (QGenExpr context be s a) Source # | |
Defined in Database.Beam.Query.Internal Methods (+) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s a # (-) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s a # (*) :: QGenExpr context be s a -> QGenExpr context be s a -> QGenExpr context be s a # negate :: QGenExpr context be s a -> QGenExpr context be s a # abs :: QGenExpr context be s a -> QGenExpr context be s a # signum :: QGenExpr context be s a -> QGenExpr context be s a # fromInteger :: Integer -> QGenExpr context be s a # | |
| (Fractional a, BeamSqlBackend be, BeamSqlBackendCanSerialize be a) => Fractional (QGenExpr context be s a) Source # | |
| (BeamSqlBackendCanSerialize be a, BeamSqlBackend be) => SqlValable (QGenExpr ctxt be s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
| ContextRewritable (QGenExpr old syntax s a) Source # | |
Defined in Database.Beam.Query.Internal Associated Types type WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # Methods rewriteContext :: Proxy ctxt -> QGenExpr old syntax s a -> WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # | |
| BeamSqlBackend be => Eq (QGenExpr context be s t) Source # | |
| 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 HaskellLiteralForQExpr (table (QGenExpr context be s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
| 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 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 HaskellLiteralForQExpr (QGenExpr context be s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
| 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 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
Instances
| contextPredicate QWindowFrameContext => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)) (QWindow be s) Source # | |
Defined in Database.Beam.Query.Internal Methods project' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be)) -> (forall context. contextPredicate context => Proxy context -> Proxy be -> WithExprContext (BeamSqlBackendWindowFrameSyntax' be) -> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))) -> QWindow be s -> m (QWindow be s) Source # projectSkeleton' :: Monad m => Proxy contextPredicate -> Proxy (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be)) -> (forall context. contextPredicate context => Proxy context -> Proxy be -> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))) -> m (QWindow be s) Source # | |
type Projectible be = ProjectibleWithPredicate AnyType be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) Source #
class BeamSqlBackend be => HasQBuilder be where Source #
Methods
buildSqlQuery :: Projectible be a => TablePrefix -> Q be db s a -> BeamSqlBackendSelectSyntax be Source #
Instances
| BeamSqlBackend (MockSqlBackend cmd) => HasQBuilder (MockSqlBackend cmd) Source # | |
Defined in Database.Beam.Query.Types Methods buildSqlQuery :: forall a (db :: (Type -> Type) -> Type) s. Projectible (MockSqlBackend cmd) a => TablePrefix -> Q (MockSqlBackend cmd) db s a -> BeamSqlBackendSelectSyntax (MockSqlBackend cmd) Source # | |