opaleye-sqlite-0.0.0.1: An SQL-generating DSL targeting SQLite

Safe HaskellNone
LanguageHaskell98

Opaleye.SQLite.Internal.Table

Synopsis

Documentation

data Table writerColumns viewColumns Source

Define a table as follows, where "id", "color", "location", "quantity" and "radius" are the tables columns in Postgres and the types are given in the type signature. The id field is an autoincrementing field (i.e. optional for writes).

data Widget a b c d e = Widget { wid      :: a
                               , color    :: b
                               , location :: c
                               , quantity :: d
                               , radius   :: e }

$(makeAdaptorAndInstance "pWidget" ''Widget)

widgetTable :: Table (Widget (Maybe (Column PGInt4)) (Column PGText) (Column PGText)
                             (Column PGInt4) (Column PGFloat8))
                     (Widget (Column PGText) (Column PGText) (Column PGText)
                             (Column PGInt4) (Column PGFloat8))
widgetTable = Table "widgetTable"
                     (pWidget Widget { wid      = optional "id"
                                     , color    = required "color"
                                     , location = required "location"
                                     , quantity = required "quantity"
                                     , radius   = required "radius" })

Constructors

Table String (TableProperties writerColumns viewColumns) 

Instances

data TableProperties writerColumns viewColumns Source

Constructors

TableProperties (Writer writerColumns viewColumns) (View viewColumns) 

data View columns Source

Constructors

View columns 

newtype Writer columns dummy Source

Constructors

Writer (forall f. Functor f => PackMap (f PrimExpr, String) () (f columns) ()) 

queryTable :: ColumnMaker viewColumns columns -> Table writerColumns viewColumns -> Tag -> (columns, PrimQuery) Source

runColumnMaker :: ColumnMaker tablecolumns columns -> Tag -> tablecolumns -> (columns, [(Symbol, PrimExpr)]) Source

runWriter :: Writer columns columns' -> columns -> [(PrimExpr, String)] Source

runWriter' :: Writer columns columns' -> NonEmpty columns -> (NonEmpty [PrimExpr], [String]) Source

data Zip a Source

Constructors

Zip 

Fields

unZip :: NonEmpty [a]
 

Instances

Monoid (Zip a)