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

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

Database.Relational.Record

Contents

Description

This module defines interfaces of projected record type.

Synopsis

Record data structure and interface

data Record c t Source #

Phantom typed record. Projected into Haskell record type t.

Instances

ProjectableMaybe (Record c) Source #

Control phantom Maybe type in record type Record.

Methods

just :: Record c a -> Record c (Maybe a) Source #

flattenMaybe :: Record c (Maybe (Maybe a)) -> Record c (Maybe a) Source #

ProjectableShowSql (Record c) Source # 
SqlContext c => SqlProjectable (Record c) Source #

Unsafely make Record from SQL terms.

Show (Record c t) Source # 

Methods

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

show :: Record c t -> String #

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

width :: Record c r -> Int Source #

Width of Record.

columns Source #

Arguments

:: Record c r

Source Record

-> [StringSQL]

Result SQL string list

Get column SQL string list of record.

untype :: Record c r -> Tuple Source #

Get untyped tuple.

unsafeFromSqlTerms :: [StringSQL] -> Record c t Source #

Unsafely generate Record from SQL expression strings.

unsafeFromQualifiedSubQuery :: Qualified SubQuery -> Record c t Source #

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

unsafeFromScalarSubQuery :: SubQuery -> Record c t Source #

Unsafely generate Record from scalar sub-query.

unsafeFromTable :: Table r -> Record c r Source #

Unsafely generate unqualified Record from Table.

unsafeStringSql :: Record c r -> StringSQL Source #

Unsafely get SQL term from Record.

Projections

pi Source #

Arguments

:: PersistableWidth a 
=> Record c a

Source Record

-> Pi a b

Record path

-> Record c b

Narrower Record

Trace projection path to get narrower Record.

piMaybe Source #

Arguments

:: PersistableWidth a 
=> Record c (Maybe a)

Source Record. Maybe type

-> Pi a b

Projection path

-> Record c (Maybe b)

Narrower Record. Maybe type result

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

piMaybe' Source #

Arguments

:: PersistableWidth a 
=> Record c (Maybe a)

Source Record. Maybe type

-> Pi a (Maybe b)

Projection path. Maybe type leaf

-> Record c (Maybe b)

Narrower Record. Maybe type result

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

wpi Source #

Arguments

:: PersistableRecordWidth a 
-> Record c a

Source Record

-> Pi a b

Projection path

-> Record c b

Narrower Record

Trace projection path to get narrower Record.

flattenMaybe :: Record c (Maybe (Maybe a)) -> Record c (Maybe a) Source #

Composite nested Maybe on record phantom type.

just :: Record c r -> Record c (Maybe r) Source #

Cast into Maybe on record phantom type.

unsafeToAggregated :: Record Flat r -> Record Aggregated r Source #

Unsafely lift to aggregated context.

unsafeToFlat :: Record Aggregated r -> Record Flat r Source #

Unsafely down to flat context.

unsafeChangeContext :: Record c r -> Record c' r Source #

Unsafely cast context type tag.

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

Unsafely get SQL string expression of not null key record.

List of Record

data RecordList p t Source #

Projected record list type for row list.

list :: [p t] -> RecordList p t Source #

Make projected record list from Record list.

unsafeListFromSubQuery :: SubQuery -> RecordList p t Source #

Make projected record list from SubQuery.

unsafeStringSqlList :: (p t -> StringSQL) -> RecordList p t -> StringSQL Source #

Map record show operatoions and concatinate to single SQL expression.

Orphan instances

ProductIsoFunctor (Record c) Source #

Map Record which result type is record.

Methods

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

ProductIsoApplicative (Record c) Source #

Compose Record using applicative style.

Methods

pureP :: ProductConstructor a => a -> Record c a #

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

ProductIsoEmpty (Record c) () Source # 

Methods

pureE :: Record c () #

peRight :: Record c (a, ()) -> Record c a #

peLeft :: Record c ((), a) -> Record c a #