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

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

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 -> Int Source

Width of Projection.

columns Source

Arguments

:: Projection c r

Source Projection

-> [ColumnSQL]

Result SQL string list

Get column SQL string list of projection.

untype :: Projection c r -> UntypedProjection Source

Unsafely get untyped projection.

unsafeFromSqlTerms :: [StringSQL] -> Projection c t Source

Unsafely generate Projection from SQL expression strings.

unsafeFromQualifiedSubQuery :: Qualified SubQuery -> Projection c t Source

Unsafely generate Projection from qualified (joined) subquery.

unsafeFromScalarSubQuery :: SubQuery -> Projection c t Source

Unsafely generate Projection from scalar subquery.

unsafeFromTable :: Table r -> Projection c r Source

Unsafely generate unqualified Projection from Table.

predicateProjectionFromExpr :: Expr c (Maybe Bool) -> Projection c (Maybe Bool) Source

Lift Expr to Projection to use as restrict predicate.

unsafeStringSql :: Projection c r -> StringSQL Source

Unsafely get SQL term from Proejction.

Projections

pi Source

Arguments

:: Projection c a

Source Projection

-> Pi a b

Projection path

-> Projection c b

Narrower Projection

Trace projection path to get narrower Projection.

piMaybe Source

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 r Source

Unsafely lift to aggregated context.

unsafeToFlat :: Projection Aggregated r -> Projection Flat r Source

Unsafely down to flat context.

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

Unsafely cast context type tag.

unsafeStringSqlNotNullMaybe :: HasColumnConstraint NotNull r => Projection c (Maybe r) -> StringSQL Source

Unsafely get SQL string expression of not null key projection.

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

Projectable fmap of Projection type.

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

Projectable ap of Projection type.

List Projection

data ListProjection p t Source

Projection type for row list.

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

Make row list projection from Projection list.

unsafeListFromSubQuery :: SubQuery -> ListProjection p t Source

Make row list projection from SubQuery.

unsafeStringSqlList :: (p t -> StringSQL) -> ListProjection p t -> StringSQL Source

Map projection show operatoions and concatinate to single SQL expression.