module Database.Beam.Query.Operator
( SqlBool
, (&&.), (||.), not_, div_, mod_
, (&&?.), (||?.), sqlNot_
, like_, similarTo_
, concat_
) where
import Database.Beam.Backend.SQL
import Database.Beam.Query.Internal
import Control.Applicative
import qualified Data.Text as T
data SqlBool
(&&.) :: IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s Bool
-> QGenExpr context syntax s Bool
-> QGenExpr context syntax s Bool
(&&.) = qBinOpE andE
(||.) :: IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s Bool
-> QGenExpr context syntax s Bool
-> QGenExpr context syntax s Bool
(||.) = qBinOpE orE
(&&?.) :: IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s SqlBool
-> QGenExpr context syntax s SqlBool
-> QGenExpr context syntax s SqlBool
(&&?.) = qBinOpE andE
(||?.) :: IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s SqlBool
-> QGenExpr context syntax s SqlBool
-> QGenExpr context syntax s SqlBool
(||?.) = qBinOpE orE
infixr 3 &&., &&?.
infixr 2 ||., ||?.
like_ ::
( IsSqlExpressionSyntaxStringType syntax text
, IsSql92ExpressionSyntax syntax ) =>
QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s Bool
like_ (QExpr scrutinee) (QExpr search) =
QExpr (liftA2 likeE scrutinee search)
similarTo_ ::
( IsSqlExpressionSyntaxStringType syntax text
, IsSql99ExpressionSyntax syntax ) =>
QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s text
similarTo_ (QExpr scrutinee) (QExpr search) =
QExpr (liftA2 similarToE scrutinee search)
infix 4 `like_`, `similarTo_`
not_ :: forall syntax context s.
IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s Bool
-> QGenExpr context syntax s Bool
not_ (QExpr a) = QExpr (fmap notE a)
sqlNot_ :: forall syntax context s.
IsSql92ExpressionSyntax syntax
=> QGenExpr context syntax s SqlBool
-> QGenExpr context syntax s SqlBool
sqlNot_ (QExpr a) = QExpr (fmap notE a)
div_ :: (Integral a, IsSql92ExpressionSyntax syntax)
=> QGenExpr context syntax s a -> QGenExpr context syntax s a
-> QGenExpr context syntax s a
div_ = qBinOpE divE
infixl 7 `div_`, `mod_`
mod_ :: (Integral a, IsSql92ExpressionSyntax syntax)
=> QGenExpr context syntax s a -> QGenExpr context syntax s a
-> QGenExpr context syntax s a
mod_ = qBinOpE modE
concat_ :: IsSql99ConcatExpressionSyntax syntax
=> [ QGenExpr context syntax s T.Text ] -> QGenExpr context syntax s T.Text
concat_ es = QExpr (concatE <$> mapM (\(QExpr e) -> e) es)