relational-query-0.12.0.0: Typeful, Modular, Relational, algebraic query engine

Copyright2017 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe
LanguageHaskell2010

Database.Relational.ProjectableClass

Contents

Description

This module provides interfaces to preserve constraints of direct product projections.

Synopsis

Literal SQL terms

class LiteralSQL a where Source #

LiteralSQL a is implicit rule to derive function to convert from haskell record type a into SQL literal row-value.

Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming) with default signature is available for LiteralSQL class, so you can make instance like below:

  {-# LANGUAGE DeriveGeneric #-}
  import GHC.Generics (Generic)
  --
  data Foo = Foo { ... } deriving Generic
  instance LiteralSQL Foo

Methods

showLiteral' :: a -> DList StringSQL Source #

showLiteral' :: (Generic a, GLiteralSQL (Rep a)) => a -> DList StringSQL Source #

showLiteral :: LiteralSQL a => a -> [StringSQL] Source #

Convert from haskell record to SQL literal row-value.

type StringSQL = Keyword Source #

String wrap type for SQL strings.

Deprecated.

type ShowConstantTermsSQL = LiteralSQL Source #

Deprecated: Use LiteralSQL instead of this.

Deprecated.

showConstantTermsSQL' :: ShowConstantTermsSQL a => a -> DList StringSQL Source #

Deprecated: Use showLiteral' instead of this.

showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] Source #

Deprecated: Use showLiteral instead of this.

Deprecated.