Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains support for defining "ad-hoc" queries. That
is queries on tables that do not necessarily have corresponding
Beamable
table types.
Synopsis
- class Adhoc structure where
- type AdhocTable structure (f :: Type -> Type) :: Type
- mkAdhocField :: (forall a. Text -> f a) -> structure -> AdhocTable structure f
- data NamedField a
- table_ :: forall be db structure s. (Adhoc structure, BeamSqlBackend be, Projectible be (AdhocTable structure (QExpr be s))) => Maybe Text -> Text -> structure -> Q be db s (AdhocTable structure (QExpr be s))
- field_ :: forall a. Text -> NamedField a
Documentation
class Adhoc structure where Source #
mkAdhocField :: (forall a. Text -> f a) -> structure -> AdhocTable structure f Source #
Instances
Adhoc (NamedField a) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (NamedField a) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> NamedField a -> AdhocTable (NamedField a) f Source # | |
(Adhoc a, Adhoc b) => Adhoc (a, b) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> (a, b) -> AdhocTable (a, b) f Source # | |
(Adhoc a, Adhoc b, Adhoc c) => Adhoc (a, b, c) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> (a, b, c) -> AdhocTable (a, b, c) f Source # | |
(Adhoc a, Adhoc b, Adhoc c, Adhoc d) => Adhoc (a, b, c, d) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c, d) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> (a, b, c, d) -> AdhocTable (a, b, c, d) f Source # | |
(Adhoc a, Adhoc b, Adhoc c, Adhoc d, Adhoc e) => Adhoc (a, b, c, d, e) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c, d, e) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> (a, b, c, d, e) -> AdhocTable (a, b, c, d, e) f Source # | |
(Adhoc a, Adhoc b, Adhoc c, Adhoc d, Adhoc e, Adhoc f) => Adhoc (a, b, c, d, e, f) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c, d, e, f) f :: Type Source # mkAdhocField :: (forall a0. Text -> f0 a0) -> (a, b, c, d, e, f) -> AdhocTable (a, b, c, d, e, f) f0 Source # | |
(Adhoc a, Adhoc b, Adhoc c, Adhoc d, Adhoc e, Adhoc f, Adhoc g) => Adhoc (a, b, c, d, e, f, g) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c, d, e, f, g) f :: Type Source # mkAdhocField :: (forall a0. Text -> f0 a0) -> (a, b, c, d, e, f, g) -> AdhocTable (a, b, c, d, e, f, g) f0 Source # | |
(Adhoc a, Adhoc b, Adhoc c, Adhoc d, Adhoc e, Adhoc f, Adhoc g, Adhoc h) => Adhoc (a, b, c, d, e, f, g, h) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (a, b, c, d, e, f, g, h) f :: Type Source # mkAdhocField :: (forall a0. Text -> f0 a0) -> (a, b, c, d, e, f, g, h) -> AdhocTable (a, b, c, d, e, f, g, h) f0 Source # |
data NamedField a Source #
Instances
Adhoc (NamedField a) Source # | |
Defined in Database.Beam.Query.Adhoc type AdhocTable (NamedField a) f :: Type Source # mkAdhocField :: (forall a0. Text -> f a0) -> NamedField a -> AdhocTable (NamedField a) f Source # | |
type AdhocTable (NamedField a) f Source # | |
Defined in Database.Beam.Query.Adhoc |
table_ :: forall be db structure s. (Adhoc structure, BeamSqlBackend be, Projectible be (AdhocTable structure (QExpr be s))) => Maybe Text -> Text -> structure -> Q be db s (AdhocTable structure (QExpr be s)) Source #
Introduce a table into a query without using the Beamable
and Database
machinery.
The first argument is the optional name of the schema the table is in and the second is the name of the table to source from.
The third argument is a tuple (or any nesting of tuples) where each value is of type NamedField
(use field_
to construct).
The return value is a tuple (or any nesting of tuples) of the same shape as structure
but where
each value is a QGenExpr
.
For example, to source from the table Table1
, with fields Field1
(A boolean), Field2
(a
timestamp), and Field3
(a string)
table_ Nothing "Table1" ( field_ @Bool "Field1", field_ @UTCTime "Field2", field_ @Text "Field3" )
field_ :: forall a. Text -> NamedField a Source #
Used to construct NamedField
s, most often with an explicitly applied type.
The type can be omitted if the value is used unambiguously elsewhere.