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

Copyright2013-2017 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 #

Phantom typed projection. Projected into Haskell record type t.

Instances

ProjectableMaybe (Projection c) #

Control phantom Maybe type in projection type Projection.

Methods

just :: Projection c a -> Projection c (Maybe a) #

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

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.

Show (Projection c t) # 

Methods

showsPrec :: Int -> Projection c t -> ShowS #

show :: Projection c t -> String #

showList :: [Projection c t] -> ShowS #

width :: Projection c r -> Int #

Width of Projection.

columns #

Arguments

:: Projection c r

Source Projection

-> [StringSQL]

Result SQL string list

Get column SQL string list of projection.

untype :: Projection c r -> UntypedProjection #

Unsafely get untyped projection.

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

Unsafely generate Projection from SQL expression strings.

unsafeFromQualifiedSubQuery :: Qualified SubQuery -> Projection c t #

Unsafely generate Projection from qualified (joined) sub-query.

unsafeFromScalarSubQuery :: SubQuery -> Projection c t #

Unsafely generate Projection from scalar sub-query.

unsafeFromTable :: Table r -> Projection c r #

Unsafely generate unqualified Projection from Table.

unsafeStringSql :: Projection c r -> StringSQL #

Unsafely get SQL term from Proejction.

Projections

pi #

Arguments

:: PersistableWidth a 
=> Projection c a

Source Projection

-> Pi a b

Projection path

-> Projection c b

Narrower Projection

Trace projection path to get narrower Projection.

piMaybe #

Arguments

:: PersistableWidth a 
=> 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' #

Arguments

:: PersistableWidth a 
=> 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.

wpi #

Arguments

:: PersistableRecordWidth a 
-> Projection c a

Source Projection

-> Pi a b

Projection path

-> Projection c b

Narrower Projection

Trace projection path to get narrower Projection.

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

Composite nested Maybe on projection phantom type.

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

Cast into Maybe on projection phantom type.

unsafeToAggregated :: Projection Flat r -> Projection Aggregated r #

Unsafely lift to aggregated context.

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

Unsafely down to flat context.

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

Unsafely cast context type tag.

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

Unsafely get SQL string expression of not null key projection.

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

Projectable fmap of Projection type.

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

Projectable ap of Projection type.

List Projection

data ListProjection p t #

Projection type for row list.

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

Make row list projection from Projection list.

unsafeListFromSubQuery :: SubQuery -> ListProjection p t #

Make row list projection from SubQuery.

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

Map projection show operatoions and concatinate to single SQL expression.

Orphan instances

ProjectableApplicative (Projection c) #

Compose record type Projection using applicative style.

Methods

(|*|) :: Projection c (a -> b) -> Projection c a -> Projection c b #

ProjectableFunctor (Projection c) #

Compose seed of record type Projection.

Methods

(|$|) :: ProductConstructor (a -> b) => (a -> b) -> Projection c a -> Projection c b #