pg-store-0.5.0: Simple storage interface to PostgreSQL

Copyright(c) Ole Krüger 2016
LicenseBSD3
MaintainerOle Krüger <ole@vprsm.de>
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Store.Table

Contents

Description

 

Synopsis

Table

data Table Source #

Description of a table

Constructors

Table 

Fields

Instances

Eq Table Source # 

Methods

(==) :: Table -> Table -> Bool #

(/=) :: Table -> Table -> Bool #

Ord Table Source # 

Methods

compare :: Table -> Table -> Ordering #

(<) :: Table -> Table -> Bool #

(<=) :: Table -> Table -> Bool #

(>) :: Table -> Table -> Bool #

(>=) :: Table -> Table -> Bool #

max :: Table -> Table -> Table #

min :: Table -> Table -> Table #

Show Table Source # 

Methods

showsPrec :: Int -> Table -> ShowS #

show :: Table -> String #

showList :: [Table] -> ShowS #

class Entity a => TableEntity a where Source #

Table entity with extra information about its name and column names

Methods

describeTableType :: Tagged a Table Source #

Describe the table type.

describeTableType :: GenericTable a => Tagged a Table Source #

Describe the table type.

genTableName :: Table -> QueryGenerator a Source #

Embed table name.

genTableColumns :: Table -> QueryGenerator a Source #

Embed a comma-seperated list of the table's columns.

genTableColumnsOn :: Table -> ByteString -> QueryGenerator a Source #

Same as genTableColumns but expands the columns on an alias of the table name.

type GenericTable a = (Generic a, GTable (AnalyzeTable a)) Source #

Constraint for generic tables

describeGenericTable :: forall a. GenericTable a => Tagged a Table Source #

Fetch the table description for a generic table type.

Helpers

data KColumns Source #

Type-level description of a record

data KTable Source #

Type-level description of a table

Constructors

TTable Symbol KColumns 

class GColumns rec where Source #

Provide the means to demote KColumns to a value.

Minimal complete definition

gDescribeColumns

Methods

gDescribeColumns :: Tagged rec [ByteString] Source #

Instantiate singleton

Instances

class GTable tbl where Source #

Provide the means to demote KTable to a value.

Minimal complete definition

gDescribeTable

Methods

gDescribeTable :: Tagged tbl Table Source #

Instantiate singleton

Instances

(KnownSymbol name, GColumns cols) => GTable (TTable name cols) Source # 

type family AnalyzeRecordRep org (rec :: * -> *) :: KColumns where ... Source #

Check the Generic representation of a record in order to generate an instance of KColumns.

Equations

AnalyzeRecordRep org (S1 (MetaSel (Just name) m1 m2 m3) (Rec0 typ)) = TSelector name typ 
AnalyzeRecordRep org (S1 (MetaSel Nothing m1 m2 m3) a) = TypeError ((Text "Given type " :<>: ShowType org) :<>: Text " must have a single record constructor") 
AnalyzeRecordRep org (lhs :*: rhs) = TCombine (AnalyzeRecordRep org lhs) (AnalyzeRecordRep org rhs) 
AnalyzeRecordRep org U1 = TypeError ((Text "Given type " :<>: ShowType org) :<>: Text " has one constructor, therefore that constructor must have at least one field") 
AnalyzeRecordRep org other = TypeError (((Text "Given type " :<>: ShowType org) :<>: Text " has a constructor with an invalid selector") :$$: ShowType other) 

type family AnalyzeTableRep org (dat :: * -> *) :: KTable where ... Source #

Check the Generic representation of a data type in order to generate an instance of KTable.

Equations

AnalyzeTableRep org (D1 meta1 (C1 (MetaCons name f True) sel)) = TTable name (AnalyzeRecordRep org sel) 
AnalyzeTableRep org (D1 meta other) = TypeError ((Text "Given type " :<>: ShowType org) :<>: Text " must have a single record constructor") 
AnalyzeTableRep org other = TypeError (((Text "Given type " :<>: ShowType org) :<>: Text " is not a valid data type") :$$: ShowType other) 

type AnalyzeTable a = AnalyzeTableRep a (Rep a) Source #

Analyzes a type in order to retrieve its KTable representation.