Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- insertStmtFor :: forall a. Entity a => String
- updateStmtFor :: forall a. Entity a => String
- selectFromStmt :: forall a. Entity a => WhereClauseExpr -> String
- deleteStmtFor :: forall a. Entity a => String
- createTableStmtFor :: forall a. Entity a => Database -> String
- dropTableStmtFor :: forall a. Entity a => String
- data WhereClauseExpr
- data Field
- field :: String -> Field
- whereClauseValues :: WhereClauseExpr -> [SqlValue]
- (&&.) :: WhereClauseExpr -> WhereClauseExpr -> WhereClauseExpr
- (||.) :: WhereClauseExpr -> WhereClauseExpr -> WhereClauseExpr
- (=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- (>.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- (<.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- (>=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- (<=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- (<>.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- like :: Convertible b SqlValue => Field -> b -> WhereClauseExpr
- contains :: Convertible a SqlValue => Field -> a -> WhereClauseExpr
- between :: (Convertible a1 SqlValue, Convertible a2 SqlValue) => Field -> (a1, a2) -> WhereClauseExpr
- in' :: Convertible b SqlValue => Field -> [b] -> WhereClauseExpr
- isNull :: Field -> WhereClauseExpr
- not' :: WhereClauseExpr -> WhereClauseExpr
- sqlFun :: String -> Field -> Field
- allEntries :: WhereClauseExpr
- byId :: Convertible a SqlValue => a -> WhereClauseExpr
Documentation
insertStmtFor :: forall a. Entity a => String Source #
This module defines some basic SQL statements for Record Data Types that are instances of Entity
.
The SQL statements are generated using Haskell generics to provide compile time reflection capabilities.
A function that returns an SQL insert statement for an entity. Type a
must be an instance of Data.
The function will use the field names of the data type to generate the column names in the insert statement.
The values of the fields will be used as the values in the insert statement.
Output example: INSERT INTO Person (id, name, age, address) VALUES (123456, Alice, 25, "123 Main St");
updateStmtFor :: forall a. Entity a => String Source #
A function that returns an SQL update statement for an entity. Type a
must be an instance of Entity.
selectFromStmt :: forall a. Entity a => WhereClauseExpr -> String Source #
A function that returns an SQL select statement for an entity. Type a
must be an instance of Entity.
The function takes a where clause expression as parameter. This expression is used to filter the result set.
deleteStmtFor :: forall a. Entity a => String Source #
dropTableStmtFor :: forall a. Entity a => String Source #
data WhereClauseExpr Source #
Instances
Show WhereClauseExpr Source # | |
Defined in Database.GP.Query showsPrec :: Int -> WhereClauseExpr -> ShowS # show :: WhereClauseExpr -> String # showList :: [WhereClauseExpr] -> ShowS # | |
Eq WhereClauseExpr Source # | |
Defined in Database.GP.Query (==) :: WhereClauseExpr -> WhereClauseExpr -> Bool # (/=) :: WhereClauseExpr -> WhereClauseExpr -> Bool # |
whereClauseValues :: WhereClauseExpr -> [SqlValue] Source #
(&&.) :: WhereClauseExpr -> WhereClauseExpr -> WhereClauseExpr infixl 3 Source #
(||.) :: WhereClauseExpr -> WhereClauseExpr -> WhereClauseExpr infixl 2 Source #
(=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
(>.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
(<.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
(>=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
(<=.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
(<>.) :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
like :: Convertible b SqlValue => Field -> b -> WhereClauseExpr infixl 4 Source #
contains :: Convertible a SqlValue => Field -> a -> WhereClauseExpr infixl 4 Source #
between :: (Convertible a1 SqlValue, Convertible a2 SqlValue) => Field -> (a1, a2) -> WhereClauseExpr infixl 4 Source #
in' :: Convertible b SqlValue => Field -> [b] -> WhereClauseExpr infixl 4 Source #
isNull :: Field -> WhereClauseExpr Source #
byId :: Convertible a SqlValue => a -> WhereClauseExpr Source #