relational-query-0.0.1.10: Typeful, Modular, Relational, algebraic query engine

Portabilityunknown
Stabilityexperimental
Maintainerex8k.hibino@gmail.com
Safe HaskellNone

Database.Relational.Query.Projection

Contents

Description

This module defines query projection type structure and interfaces.

Synopsis

Projection data structure and interface

data Projection c t Source

Phantom typed projection. Projected into Haskell record type t.

Instances

ProjectableApplicative (Projection c)

Compose record type Projection using applicative style.

ProjectableFunctor (Projection c)

Compose seed of record type Projection.

ProjectableMaybe (Projection c)

Control phantom Maybe type in projection type Projection.

ProjectableShowSql (Projection c)

Unsafely get SQL term from Proejction.

SqlProjectable (Projection OverWindow)

Unsafely make Projection from SQL terms.

SqlProjectable (Projection Aggregated)

Unsafely make Projection from SQL terms.

SqlProjectable (Projection Flat)

Unsafely make Projection from SQL terms.

width :: Projection c r -> IntSource

Width of Projection.

columnsSource

Arguments

:: Projection c r

Source Projection

-> [ColumnSQL]

Result SQL string list

Get column SQL string list of projection.

untype :: Projection c r -> UntypedProjectionSource

Unsafely get untyped projection.

unsafeFromColumnsSource

Arguments

:: [ColumnSQL]

SQL string list specifies columns

-> Projection c r

Result Projection

Unsafely generate Projection from SQL string list.

unsafeFromQualifiedSubQuery :: Qualified SubQuery -> Projection c tSource

Unsafely generate Projection from qualified (joined) subquery.

unsafeFromScalarSubQuery :: SubQuery -> Projection c tSource

Unsafely generate Projection from scalar subquery.

unsafeFromTable :: Table r -> Projection c rSource

Unsafely generate unqualified Projection from Table.

Projections

piSource

Arguments

:: Projection c a

Source Projection

-> Pi a b

Projection path

-> Projection c b

Narrower Projection

Trace projection path to get narrower Projection.

piMaybeSource

Arguments

:: Projection c (Maybe a)

Source Projection. Maybe type

-> Pi a b

Projection path

-> Projection c (Maybe b)

Narrower Projection. Maybe type result

Trace projection path to get narrower Projection. From Maybe type to Maybe type.

piMaybe'Source

Arguments

:: Projection c (Maybe a)

Source Projection. Maybe type

-> Pi a (Maybe b)

Projection path. Maybe type leaf

-> Projection c (Maybe b)

Narrower Projection. Maybe type result

Trace projection path to get narrower Projection. From Maybe type to Maybe type. Leaf type of projection path is Maybe.

flattenMaybe :: Projection c (Maybe (Maybe a)) -> Projection c (Maybe a)Source

Composite nested Maybe on projection phantom type.

just :: Projection c r -> Projection c (Maybe r)Source

Cast into Maybe on projection phantom type.

unsafeToAggregated :: Projection Flat r -> Projection Aggregated rSource

Unsafely lift to aggregated context.

unsafeToFlat :: Projection Aggregated r -> Projection Flat rSource

Unsafely down to flat context.

unsafeChangeContext :: Projection c r -> Projection c' rSource

Unsafely cast context type tag.

unsafeShowSqlNotNullMaybeProjection :: HasColumnConstraint NotNull r => Projection c (Maybe r) -> StringSource

Unsafely get SQL string expression of not null key projection.

pfmap :: ProductConstructor (a -> b) => (a -> b) -> Projection c a -> Projection c bSource

Projectable fmap of Projection type.

pap :: Projection c (a -> b) -> Projection c a -> Projection c bSource

Projectable ap of Projection type.

List Projection

data ListProjection p t Source

Projection type for row list.

list :: [p t] -> ListProjection p tSource

Make row list projection from Projection list.

unsafeShowSqlListProjection :: (p t -> String) -> ListProjection p t -> StringSource

Map projection show operatoions and concatinate to single SQL expression.