Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@
- The ability to `coerce` `SqlExpr` was removed. Instead, use
`veryUnsafeCoerceSqlExpr`. See the documentation on
`veryUnsafeCoerceSqlExpr` for safe use example.
- `unsafeCeorceSqlExpr` is provided as an option when the underlying
Haskell types are coercible. This is still unsafe, as different
`PersistFieldSql` instances may be at play.
- [#420](https://github.com/bitemyapp/esqueleto/pull/421)
- The `LockingKind` constructors are deprecated, and will be removed
from non-Internal modules in a future release. Smart constructors
replace them, and you may need to import them from a different
database-specific module.
- [#425](https://github.com/bitemyapp/esqueleto/pull/425)
- `fromBaseId` is introduced as the inverse of `toBaseId`.
- `toBaseIdMaybe` and `fromBaseIdMaybe` are introduced.

3.5.14.0
========
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Esqueleto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module Database.Esqueleto {-# WARNING "This module will switch over to the Exper
, subList_select, valList, justList
, in_, notIn, exists, notExists
, set, (=.), (+=.), (-=.), (*=.), (/=.)
, case_, toBaseId
, case_, toBaseId, fromBaseId, toBaseIdMaybe, fromBaseIdMaybe
, subSelect
, subSelectMaybe
, subSelectCount
Expand Down
4 changes: 4 additions & 0 deletions src/Database/Esqueleto/Experimental.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module Database.Esqueleto.Experimental
, ToAliasReference(..)
, ToSqlSetOperation(..)
, SqlSelect
, Nullable

-- * The Normal Stuff
, where_
Expand Down Expand Up @@ -153,6 +154,9 @@ module Database.Esqueleto.Experimental

, case_
, toBaseId
, toBaseIdMaybe
, fromBaseId
, fromBaseIdMaybe
, subSelect
, subSelectMaybe
, subSelectCount
Expand Down
3 changes: 3 additions & 0 deletions src/Database/Esqueleto/Experimental/ToMaybe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{-# LANGUAGE TypeFamilies #-}

module Database.Esqueleto.Experimental.ToMaybe
( module Database.Esqueleto.Experimental.ToMaybe
, Nullable
)
where

import Database.Esqueleto.Internal.Internal hiding (From(..), from, on)
Expand Down
79 changes: 79 additions & 0 deletions src/Database/Esqueleto/Internal/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
{-# language AllowAmbiguousTypes #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DataKinds #-}
Expand Down Expand Up @@ -36,6 +37,8 @@
-- tracker so we can safely support it.
module Database.Esqueleto.Internal.Internal where

import Data.Typeable (TypeRep, typeRep)

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The import of ‘Data.Typeable’ is redundant

Check warning on line 40 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The import of ‘Data.Typeable’ is redundant
import Data.Coerce (Coercible)
import Control.Applicative ((<|>))
import Control.Arrow (first, (***))
import Control.Exception (Exception, throw, throwIO)
Expand Down Expand Up @@ -64,7 +67,7 @@
import Data.Kind (Type)
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import qualified Data.Monoid as Monoid

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Data.Monoid’ is redundant

Check warning on line 70 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Data.Monoid’ is redundant
import Data.Proxy (Proxy(..))
import Data.Set (Set)
import qualified Data.Set as Set
Expand All @@ -74,7 +77,7 @@
import Data.Typeable (Typeable)
import Database.Esqueleto.Internal.ExprParser (TableAccess(..), parseOnExpr)
import Database.Esqueleto.Internal.PersistentImport
import Database.Persist (EntityNameDB(..), FieldNameDB(..), SymbolToField(..))

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The import of ‘Database.Persist’ is redundant

Check warning on line 80 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The import of ‘Database.Persist’ is redundant
import qualified Database.Persist
import Database.Persist.Sql.Util
( entityColumnCount
Expand Down Expand Up @@ -1283,6 +1286,65 @@
toBaseId :: ToBaseId ent => SqlExpr (Value (Key ent)) -> SqlExpr (Value (Key (BaseEnt ent)))
toBaseId = veryUnsafeCoerceSqlExprValue

-- | Like 'toBaseId', but works on 'Maybe' keys.
--
-- @since 3.6.0.0
toBaseIdMaybe
:: (ToBaseId ent)
=> SqlExpr (Value (Maybe (Key ent)))
-> SqlExpr (Value (Maybe (Key (BaseEnt ent))))
toBaseIdMaybe = veryUnsafeCoerceSqlExprValue

-- | The inverse of 'toBaseId'. Note that this is somewhat less "safe" than
-- 'toBaseId'. Calling 'toBaseId' will usually mean that a foreign key
-- constraint is present that guarantees the presence of the base ID.
-- 'fromBaseId' has no such guarantee. Consider the code example given in
-- 'toBaseId':
--
-- @
-- Bar
-- barNum Int
-- Foo
-- bar BarId
-- fooNum Int
-- Primary bar
-- @
--
-- @
-- instance ToBaseId Foo where
-- type BaseEnt Foo = Bar
-- toBaseIdWitness barId = FooKey barId
-- @
--
-- The type of 'toBaseId' for @Foo@ would be:
--
-- @
-- toBaseId :: SqlExpr (Value FooId) -> SqlExpr (Value BarId)
-- @
--
-- The foreign key constraint on @Foo@ means that every @FooId@ points to
-- a @BarId@ in the database. However, 'fromBaseId' will not have this:
--
-- @
-- fromBaseId :: SqlExpr (Value BarId) -> SqlExpr (Value FooId)
-- @
--
-- @since 3.6.0.0
fromBaseId
:: (ToBaseId ent)
=> SqlExpr (Value (Key (BaseEnt ent)))
-> SqlExpr (Value (Key ent))
fromBaseId = veryUnsafeCoerceSqlExprValue

-- | As 'fromBaseId', but works on 'Maybe' keys.
--
-- @since 3.6.0.0
fromBaseIdMaybe
:: (ToBaseId ent)
=> SqlExpr (Value (Maybe (Key (BaseEnt ent))))
-> SqlExpr (Value (Maybe (Key ent)))
fromBaseIdMaybe = veryUnsafeCoerceSqlExprValue

-- Fixity declarations
infixl 9 ^., ?.
infixl 7 *., /.
Expand Down Expand Up @@ -1473,7 +1535,7 @@
unique = finalR uniqueConstructor
-- there must be a better way to get the constrain name from a unique, make this not a list search
filterF = (==) (persistUniqueToFieldNames unique) . uniqueFields
uniqueDef = head . filter filterF . getEntityUniques . entityDef $ proxy

Check warning on line 1538 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

In the use of ‘head’

Check warning on line 1538 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

In the use of ‘head’

Check warning on line 1538 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

In the use of ‘head’

Check warning on line 1538 in src/Database/Esqueleto/Internal/Internal.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

In the use of ‘head’

-- | Render updates to be use in a SET clause for a given sql backend.
--
Expand Down Expand Up @@ -2451,6 +2513,23 @@
veryUnsafeCoerceSqlExpr :: SqlExpr a -> SqlExpr b
veryUnsafeCoerceSqlExpr (ERaw m k) = ERaw m k

-- | While 'veryUnsafeCoerceSqlExpr' allows you to coerce anything at all, this
-- requires that the two types are 'Coercible' in Haskell. This is not truly
-- safe: after all, the point of @newtype@ is to allow you to provide different
-- instances of classes like 'PersistFieldSql' and 'SqlSelect'. Using this may
-- break your code if you change the underlying SQL representation.
--
-- @since 3.6.0.0
unsafeCoerceSqlExpr :: (Coercible a b) => SqlExpr a -> SqlExpr b
unsafeCoerceSqlExpr = veryUnsafeCoerceSqlExpr

-- | Like 'unsafeCoerceSqlExpr' but for the common case where you are
-- coercing a 'Value'.
--
-- @since 3.6.0.0
unsafeCoerceSqlExprValue :: (Coercible a b) => SqlExpr (Value a) -> SqlExpr (Value b)
unsafeCoerceSqlExprValue = veryUnsafeCoerceSqlExpr

-- | Folks often want the ability to promote a Haskell function into the
-- 'SqlExpr' expression language - and naturally reach for 'fmap'.
-- Unfortunately, this is impossible. We cannot send *functions* to the
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Esqueleto/Legacy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module Database.Esqueleto.Legacy
, subList_select, valList, justList
, in_, notIn, exists, notExists
, set, (=.), (+=.), (-=.), (*=.), (/=.)
, case_, toBaseId
, case_, toBaseId, fromBaseId, fromBaseIdMaybe, toBaseIdMaybe
, subSelect
, subSelectMaybe
, subSelectCount
Expand Down
4 changes: 3 additions & 1 deletion src/Database/Esqueleto/PostgreSQL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
import qualified Data.Text as Text
import qualified Data.Text.Internal.Builder as TLB
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Builder as TLB

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant

Check warning on line 68 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Data.Text.Lazy.Builder’ is redundant
import Data.Time.Clock (UTCTime)
import qualified Database.Esqueleto.Experimental as Ex
import qualified Database.Esqueleto.Experimental.From as Ex

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant

Check warning on line 71 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.10)

The qualified import of ‘Database.Esqueleto.Experimental.From’ is redundant
import Database.Esqueleto.Experimental.From.CommonTableExpression

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.6)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant

Check warning on line 72 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.4)

The import of ‘Database.Esqueleto.Experimental.From.CommonTableExpression’ is redundant
import Database.Esqueleto.Experimental.From.SqlSetOperation

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant

Check warning on line 73 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

The import of ‘Database.Esqueleto.Experimental.From.SqlSetOperation’ is redundant
import Database.Esqueleto.Experimental.ToAlias
import Database.Esqueleto.Experimental.ToAliasReference
import Database.Esqueleto.Internal.Internal hiding

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.2)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.8)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.0)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

Module

Check warning on line 76 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.10)

Module
(From(..), ilike, distinctOn, distinctOnOrderBy, from, on, random_)
import Database.Esqueleto.Internal.PersistentImport hiding
(uniqueFields, upsert, upsertBy)
Expand Down Expand Up @@ -137,7 +137,7 @@
-- ...
-- @
--
-- @since 3.6.0
-- @since 3.6.0.0
distinctOnOrderBy :: [SqlExpr OrderBy] -> SqlQuery ()
distinctOnOrderBy exprs = do
distinctOn (toDistinctOn <$> exprs)
Expand All @@ -151,6 +151,7 @@
$ TL.replace " ASC" ""
$ TLB.toLazyText b
, vals )

-- | Empty array literal. (@val []@) does unfortunately not work
emptyArray :: SqlExpr (Value [a])
emptyArray = unsafeSqlValue "'{}'"
Expand Down Expand Up @@ -665,7 +666,7 @@
--
-- @since 3.6.0.0
forShare :: LockingKind
forShare = ForShare

Check warning on line 669 in src/Database/Esqueleto/PostgreSQL.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 8.6)

In the use of data constructor ‘ForShare’

-- | `FOR KEY SHARE OF` syntax for postgres locking
-- allows locking of specific tables with a key share lock in a view or join
Expand All @@ -680,6 +681,7 @@
-- @since 2.2.3
ilike :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value Bool)
ilike = unsafeSqlBinOp " ILIKE "
infixr 2 `ilike`

-- | @WITH@ @MATERIALIZED@ clause is used to introduce a
-- [Common Table Expression (CTE)](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL#Common_table_expression)
Expand Down
Loading