haskelldb-2.2.2: A library of combinators for generating and executing SQL statements.

Portability | non-portable
Stability | experimental
Maintainer | haskelldb-users@lists.sourceforge.net
Safe Haskell | None

Database.HaskellDB.DBLayout

Description

Exports every function needed by DBDirect generated files

Synopsis

- module Database.HaskellDB.BoundedString
- module Database.HaskellDB.DBSpec
- data CalendarTime
- data LocalTime
- data Expr a
- data Table r
- data Attr f a
- baseTable :: (ShowLabels r, ToPrimExprs r) => TableName -> Record r -> Table r
- data RecCons f a b
- data RecNil
- class FieldTag f where
  - fieldName :: f -> String
- hdbMakeEntry :: FieldTag f => f -> Record (RecCons f (Expr a) RecNil)
- mkAttr :: FieldTag f => f -> Attr f a
- (#) :: Record (RecCons f a RecNil) -> (b -> c) -> b -> RecCons f a c
- emptyTable :: TableName -> Table (Record RecNil)

# Documentation

module Database.HaskellDB.BoundedString

module Database.HaskellDB.DBSpec

data CalendarTime

`CalendarTime` is a user-readable and manipulable representation of the internal `ClockTime` type.

Instances

Eq CalendarTime |
Ord CalendarTime |
Read CalendarTime |
Show CalendarTime |
Typeable CalendarTime |
ShowConstant CalendarTime |
ExprType CalendarTime |
GetValue CalendarTime |
GetValue (Maybe CalendarTime) |

data LocalTime

A simple day and time aggregate, where the day is of the specified parameter, and the time is a TimeOfDay. Conversion of this (as local civil time) to UTC depends on the time zone. Conversion of this (as local mean time) to UT1 depends on the longitude.

Instances

Eq LocalTime |
Data LocalTime |
Ord LocalTime |
Read LocalTime |
Show LocalTime |
Typeable LocalTime |
NFData LocalTime |
ParseTime LocalTime |
ExprType LocalTime |
GetValue LocalTime |
GetValue (Maybe LocalTime) |

data Expr a Source

Type of normal expressions, contains the untyped PrimExpr.

Instances

ProjectExpr Expr |
ExprC Expr |
Read (Expr a) |
Show (Expr a) |
Args (Expr a) |
ExprType a => ExprType (Expr a) |
Args (Expr a -> ExprAggr c) |
(IsExpr tail, Args tail) => Args (Expr a -> tail) |
HasField f r => Select (Attr f a) (Rel r) (Expr a) | Field selection operator. It is overloaded to work for both relations in a query and the result of a query. That is, it corresponds to both `!` and `!.` from the original HaskellDB. An overloaded operator was selected because users (and the developers) always forgot to use !. instead of ! on query results.
(RelToRec rest, FieldTag f) => RelToRec (RecCons f (Expr a) rest) |
(ShowConstant a, ConstantRecord r cr) => ConstantRecord (RecCons f a r) (RecCons f (Expr a) cr) |
(ProjectExpr e, ProjectRec r er) => ProjectRec (RecCons f (e a) r) (RecCons f (Expr a) er) |
(InsertExpr e, InsertRec r er) => InsertRec (RecCons f (e a) r) (RecCons f (Expr a) er) |
(GetValue a, GetRec er vr) => GetRec (RecCons f (Expr a) er) (RecCons f a vr) |

data Table r Source

Basic tables, contains table name and an association from attributes to attribute names in the real table.

data Attr f a Source

Typed attributes

Instances

HasField f r => Select (Attr f a) (Rel r) (Expr a) | Field selection operator. It is overloaded to work for both relations in a query and the result of a query. That is, it corresponds to both `!` and `!.` from the original HaskellDB. An overloaded operator was selected because users (and the developers) always forgot to use !. instead of ! on query results.

baseTable :: (ShowLabels r, ToPrimExprs r) => TableName -> Record r -> Table rSource

data RecCons f a b Source

Constructor that adds a field to a record. f is the field tag, a is the field value and b is the rest of the record.

Instances

HasField f r => HasField f (RecCons g a r) |
HasField f (RecCons f a r) |
SetField f r a => SetField f (RecCons g b r) a |
SetField f (RecCons f a r) a |
(Eq a, Eq b) => Eq (RecCons f a b) |
(Ord a, Ord b) => Ord (RecCons f a b) |
(FieldTag a, Read b, ReadRecRow c) => Read (RecCons a b c) |
(FieldTag a, Show b, ShowRecRow c) => Show (RecCons a b c) |
(FieldTag a, Read b, ReadRecRow c) => ReadRecRow (RecCons a b c) |
(FieldTag a, Show b, ShowRecRow c) => ShowRecRow (RecCons a b c) |
(FieldTag f, ShowLabels r) => ShowLabels (RecCons f a r) |
(ExprC e, ToPrimExprs r) => ToPrimExprs (RecCons l (e a) r) |
(RelToRec rest, FieldTag f) => RelToRec (RecCons f (Expr a) rest) |
(ExprType e, ExprTypes r) => ExprTypes (RecCons f e r) |
RecCat r1 r2 r3 => RecCat (RecCons f a r1) r2 (RecCons f a r3) |
(ShowConstant a, ConstantRecord r cr) => ConstantRecord (RecCons f a r) (RecCons f (Expr a) cr) |
(ProjectExpr e, ProjectRec r er) => ProjectRec (RecCons f (e a) r) (RecCons f (Expr a) er) |
(InsertExpr e, InsertRec r er) => InsertRec (RecCons f (e a) r) (RecCons f (Expr a) er) |
(GetValue a, GetRec er vr) => GetRec (RecCons f (Expr a) er) (RecCons f a vr) |

data RecNil Source

The empty record.

Instances

Eq RecNil |
Ord RecNil |
Read RecNil |
Show RecNil |
ReadRecRow RecNil |
ShowRecRow RecNil |
ShowLabels RecNil |
ToPrimExprs RecNil |
RelToRec RecNil |
ExprTypes RecNil |
ConstantRecord RecNil RecNil |
ProjectRec RecNil RecNil |
InsertRec RecNil RecNil |
GetRec RecNil RecNil |
RecCat RecNil r r |
HasField f r => HasField f (Record r) |
SetField f r a => SetField f (Record r) a |
Eq r => Eq (Record r) |
Ord r => Ord (Record r) |
ReadRecRow r => Read (Record r) |
Show r => Show (Record r) |
ShowRecRow r => ShowRecRow (Record r) |
ShowLabels r => ShowLabels (Record r) |
ExprTypes r => ExprTypes (Record r) |
ConstantRecord r cr => ConstantRecord (Record r) (Record cr) |
RecCat r1 r2 r3 => RecCat (Record r1) (Record r2) (Record r3) |
SelectField f r a => Select (l f a) (Record r) a |

class FieldTag f where Source

Class for field labels.

Methods

fieldName :: f -> String Source

Gets the name of the label.

hdbMakeEntry Source

Arguments

:: FieldTag f |
=> f | Field tag
-> Record (RecCons f (Expr a) RecNil) |

Constructs a table entry from a field tag

mkAttr Source

Arguments

:: FieldTag f |
=> f | Field tag
-> Attr f a |

Make an `Attr` for a field.

(#)Source

Arguments

:: Record (RecCons f a RecNil) | Field to add
-> (b -> c) | Rest of record
-> b -> RecCons f a c | New record

Adds the field from a one-field record to another record.

emptyTable :: TableName -> Table (Record RecNil)Source

For queries against fake tables, such as 'information_schema.information_schema_catalog_name'. Useful for constructing queries that contain constant data (and do not select from columns) but need a table to select from.