| Copyright | 2017 Kei Hibino |
|---|---|
| License | BSD3 |
| Maintainer | ex8k.hibino@gmail.com |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Database.Relational.ProjectableClass
Contents
Description
This module provides interfaces to preserve constraints of direct product projections.
- class ShowConstantTermsSQL a where
- showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL]
- type StringSQL = Keyword
Literal SQL terms
class ShowConstantTermsSQL a where Source #
ShowConstantTermsSQL a is implicit rule to derive function to convert
from haskell record type a into constant SQL terms.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for ShowConstantTermsSQL class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-}
import GHC.Generics (Generic)
--
data Foo = Foo { ... } deriving Generic
instance ShowConstantTermsSQL Foo
showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] Source #
Convert from haskell record to SQL terms list.