groundhog-0.12.0: Type-safe datatype-database mapping library.
Safe HaskellNone
LanguageHaskell2010

Database.Groundhog.Generic.Sql.Functions

Description

This module has common SQL functions and operators which are supported in the most SQL databases

Synopsis

Documentation

like :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> String -> Cond db r Source #

notLike :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> String -> Cond db r Source #

in_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r Source #

notIn_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r Source #

lower :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> Expr db r a' Source #

upper :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> Expr db r a' Source #

case_ Source #

Arguments

:: (SqlDb db, ExpressionOf db r a a', ExpressionOf db r b a') 
=> [(Cond db r, a)]

Conditions

-> b

It is returned when none of conditions is true

-> Expr db r a' 

class (DbDescriptor db, QueryRaw db ~ Snippet db) => SqlDb db where Source #

This class distinguishes databases which support SQL-specific expressions. It contains ad hoc members for features whose syntax differs across the databases.

Methods

append :: (ExpressionOf db r a String, ExpressionOf db r b String) => a -> b -> Expr db r String Source #

signum' :: (ExpressionOf db r x a, Num a) => x -> Expr db r a Source #

quotRem' :: (ExpressionOf db r x a, ExpressionOf db r y a, Integral a) => x -> y -> (Expr db r a, Expr db r a) Source #

equalsOperator :: RenderS db r -> RenderS db r -> RenderS db r Source #

notEqualsOperator :: RenderS db r -> RenderS db r -> RenderS db r Source #

cot :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #

atan2 :: RealFloat a => a -> a -> a #

a version of arctangent taking two real floating-point arguments. For real floating x and y, atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y). atan2 y x returns a value in the range [-pi, pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1, with y in a type that is RealFloat, should return the same value as atan y. A default definition of atan2 is provided, but implementors can provide a more accurate implementation.

radians :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #

degrees :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #

Orphan instances

(SqlDb db, PersistField a, Enum a) => Enum (Expr db r a) Source # 
Instance details

Methods

succ :: Expr db r a -> Expr db r a #

pred :: Expr db r a -> Expr db r a #

toEnum :: Int -> Expr db r a #

fromEnum :: Expr db r a -> Int #

enumFrom :: Expr db r a -> [Expr db r a] #

enumFromThen :: Expr db r a -> Expr db r a -> [Expr db r a] #

enumFromTo :: Expr db r a -> Expr db r a -> [Expr db r a] #

enumFromThenTo :: Expr db r a -> Expr db r a -> Expr db r a -> [Expr db r a] #

(FloatingSqlDb db, PersistField a, Floating a) => Floating (Expr db r a) Source # 
Instance details

Methods

pi :: Expr db r a #

exp :: Expr db r a -> Expr db r a #

log :: Expr db r a -> Expr db r a #

sqrt :: Expr db r a -> Expr db r a #

(**) :: Expr db r a -> Expr db r a -> Expr db r a #

logBase :: Expr db r a -> Expr db r a -> Expr db r a #

sin :: Expr db r a -> Expr db r a #

cos :: Expr db r a -> Expr db r a #

tan :: Expr db r a -> Expr db r a #

asin :: Expr db r a -> Expr db r a #

acos :: Expr db r a -> Expr db r a #

atan :: Expr db r a -> Expr db r a #

sinh :: Expr db r a -> Expr db r a #

cosh :: Expr db r a -> Expr db r a #

tanh :: Expr db r a -> Expr db r a #

asinh :: Expr db r a -> Expr db r a #

acosh :: Expr db r a -> Expr db r a #

atanh :: Expr db r a -> Expr db r a #

log1p :: Expr db r a -> Expr db r a #

expm1 :: Expr db r a -> Expr db r a #

log1pexp :: Expr db r a -> Expr db r a #

log1mexp :: Expr db r a -> Expr db r a #

(SqlDb db, PersistField a, Fractional a) => Fractional (Expr db r a) Source # 
Instance details

Methods

(/) :: Expr db r a -> Expr db r a -> Expr db r a #

recip :: Expr db r a -> Expr db r a #

fromRational :: Rational -> Expr db r a #

(SqlDb db, PurePersistField a, Integral a) => Integral (Expr db r a) Source # 
Instance details

Methods

quot :: Expr db r a -> Expr db r a -> Expr db r a #

rem :: Expr db r a -> Expr db r a -> Expr db r a #

div :: Expr db r a -> Expr db r a -> Expr db r a #

mod :: Expr db r a -> Expr db r a -> Expr db r a #

quotRem :: Expr db r a -> Expr db r a -> (Expr db r a, Expr db r a) #

divMod :: Expr db r a -> Expr db r a -> (Expr db r a, Expr db r a) #

toInteger :: Expr db r a -> Integer #

(SqlDb db, PersistField a, Num a) => Num (Expr db r a) Source # 
Instance details

Methods

(+) :: Expr db r a -> Expr db r a -> Expr db r a #

(-) :: Expr db r a -> Expr db r a -> Expr db r a #

(*) :: Expr db r a -> Expr db r a -> Expr db r a #

negate :: Expr db r a -> Expr db r a #

abs :: Expr db r a -> Expr db r a #

signum :: Expr db r a -> Expr db r a #

fromInteger :: Integer -> Expr db r a #

(SqlDb db, PersistField a, Ord a) => Ord (Expr db r a) Source # 
Instance details

Methods

compare :: Expr db r a -> Expr db r a -> Ordering #

(<) :: Expr db r a -> Expr db r a -> Bool #

(<=) :: Expr db r a -> Expr db r a -> Bool #

(>) :: Expr db r a -> Expr db r a -> Bool #

(>=) :: Expr db r a -> Expr db r a -> Bool #

max :: Expr db r a -> Expr db r a -> Expr db r a #

min :: Expr db r a -> Expr db r a -> Expr db r a #

(SqlDb db, PersistField a, Real a) => Real (Expr db r a) Source # 
Instance details

Methods

toRational :: Expr db r a -> Rational #