groundhog-0.6.0: Type-safe datatype-database mapping library.

Safe HaskellNone

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 rSource

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

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

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

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 whereSource

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 StringSource

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

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 rSource

notEqualsOperator :: RenderS db r -> RenderS db r -> RenderS db rSource

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