squeal-postgresql-0.9.0.0: Squeal PostgreSQL Library
Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Expression.Math

Description

math functions

Synopsis

Math Function

atan2_ :: float `In` PGFloating => '[null float, null float] ---> null float Source #

>>> :{
let
  expression :: Expr (null 'PGfloat4)
  expression = atan2_ (pi *: 2)
in printSQL expression
:}
atan2(pi(), (2.0 :: float4))

quot_ :: int `In` PGIntegral => Operator (null int) (null int) (null int) Source #

integer division, truncates the result

>>> :{
let
  expression :: Expression grp lat with db params from (null 'PGint2)
  expression = 5 `quot_` 2
in printSQL expression
:}
((5 :: int2) / (2 :: int2))

rem_ :: int `In` PGIntegral => Operator (null int) (null int) (null int) Source #

remainder upon integer division

>>> :{
let
  expression :: Expression grp lat with db params from (null 'PGint2)
  expression = 5 `rem_` 2
in printSQL expression
:}
((5 :: int2) % (2 :: int2))

trunc :: frac `In` PGFloating => null frac --> null frac Source #

>>> :{
let
  expression :: Expression grp lat with db params from (null 'PGfloat4)
  expression = trunc pi
in printSQL expression
:}
trunc(pi())

round_ :: frac `In` PGFloating => null frac --> null frac Source #

>>> :{
let
  expression :: Expression grp lat with db params from (null 'PGfloat4)
  expression = round_ pi
in printSQL expression
:}
round(pi())

ceiling_ :: frac `In` PGFloating => null frac --> null frac Source #

>>> :{
let
  expression :: Expression grp lat with db params from (null 'PGfloat4)
  expression = ceiling_ pi
in printSQL expression
:}
ceiling(pi())