esqueleto 2.2.2 → 2.2.3
raw patch · 5 files changed
+26/−4 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Database.Esqueleto: ilike :: (Esqueleto query expr backend, PersistField s, IsString s) => expr (Value s) -> expr (Value s) -> expr (Value Bool)
+ Database.Esqueleto.Internal.Language: ilike :: (Esqueleto query expr backend, PersistField s, IsString s) => expr (Value s) -> expr (Value s) -> expr (Value Bool)
Files
- esqueleto.cabal +1/−1
- src/Database/Esqueleto.hs +1/−1
- src/Database/Esqueleto/Internal/Language.hs +7/−1
- src/Database/Esqueleto/Internal/Sql.hs +1/−0
- test/Test.hs +16/−1
esqueleto.cabal view
@@ -1,5 +1,5 @@ name: esqueleto-version: 2.2.2+version: 2.2.3 synopsis: Type-safe EDSL for SQL queries on persistent backends. homepage: https://github.com/prowdsponsor/esqueleto license: BSD3
src/Database/Esqueleto.hs view
@@ -46,7 +46,7 @@ , random_, round_, ceiling_, floor_ , min_, max_, sum_, avg_, lower_ , coalesce, coalesceDefault- , like, (%), concat_, (++.)+ , like, ilike, (%), concat_, (++.) , subList_select, subList_selectDistinct, valList , in_, notIn, exists, notExists , set, (=.), (+=.), (-=.), (*=.), (/=.)
src/Database/Esqueleto/Internal/Language.hs view
@@ -276,6 +276,12 @@ -- | @LIKE@ operator. like :: (PersistField s, IsString s) => expr (Value s) -> expr (Value s) -> expr (Value Bool)+ -- | @ILIKE@ operator (case-insensitive @LIKE@).+ --+ -- Supported by PostgreSQL only.+ --+ -- /Since: 2.2.3/+ ilike :: (PersistField s, IsString s) => expr (Value s) -> expr (Value s) -> expr (Value Bool) -- | The string @'%'@. May be useful while using 'like' and -- concatenation ('concat_' or '++.', depending on your -- database). Note that you always to type the parenthesis,@@ -391,7 +397,7 @@ infixr 5 ++. infix 4 ==., >=., >., <=., <., !=. infixr 3 &&., =., +=., -=., *=., /=.-infixr 2 ||., `like`+infixr 2 ||., `like`, `ilike` infixl 2 `InnerJoin`, `CrossJoin`, `LeftOuterJoin`, `RightOuterJoin`, `FullOuterJoin` -- | Syntax sugar for 'case_'.
src/Database/Esqueleto/Internal/Sql.hs view
@@ -445,6 +445,7 @@ coalesceDefault exprs = unsafeSqlFunctionParens "COALESCE" . (exprs ++) . return . just like = unsafeSqlBinOp " LIKE "+ ilike = unsafeSqlBinOp " ILIKE " (%) = unsafeSqlValue "'%'" concat_ = unsafeSqlFunction "CONCAT" (++.) = unsafeSqlBinOp " || "
test/Test.hs view
@@ -860,7 +860,7 @@ #endif #endif - describe "text functions" $+ describe "text functions" $ do it "like, (%) and (++.) work on a simple example" $ run $ do [p1e, p2e, p3e, p4e] <- mapM insert' [p1, p2, p3, p4]@@ -874,6 +874,21 @@ nameContains "h" [p1e, p2e] nameContains "i" [p4e, p3e] nameContains "iv" [p4e]++#if defined(WITH_POSTGRESQL)+ it "ilike, (%) and (++.) work on a simple example on PostgreSQL" $+ run $ do+ [p1e, p2e, p3e, p4e, p5e] <- mapM insert' [p1, p2, p3, p4, p5]+ let nameContains t expected = do+ ret <- select $+ from $ \p -> do+ where_ (p ^. PersonName `ilike` (%) ++. val t ++. (%))+ orderBy [asc (p ^. PersonName)]+ return p+ liftIO $ ret `shouldBe` expected+ nameContains "mi" [p3e, p5e]+ nameContains "JOHN" [p1e]+#endif describe "delete" $ it "works on a simple example" $