esqueleto-2.5.1: Type-safe EDSL for SQL queries on persistent backends.

Safe Haskell | None
Language | Haskell98

Database.Esqueleto.Internal.Sql

Contents

- The pretty face
- The guts

Description

This is an internal module, anything exported by this module may change without a major version bump. Please use only Database.Esqueleto if possible.

Synopsis

- data SqlQuery a
- data SqlExpr a
- type SqlEntity ent = (PersistEntity ent, PersistEntityBackend ent ~ SqlBackend)
- select :: (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r]
- selectSource :: (SqlSelect a r, MonadResource m) => SqlQuery a -> Source (SqlPersistT m) r
- selectDistinct :: (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlPersistT m [r]
- selectDistinctSource :: (SqlSelect a r, MonadResource m) => SqlQuery a -> Source (SqlPersistT m) r
- delete :: MonadIO m => SqlQuery () -> SqlWriteT m ()
- deleteCount :: MonadIO m => SqlQuery () -> SqlWriteT m Int64
- update :: (MonadIO m, SqlEntity val) => (SqlExpr (Entity val) -> SqlQuery ()) -> SqlWriteT m ()
- updateCount :: (MonadIO m, SqlEntity val) => (SqlExpr (Entity val) -> SqlQuery ()) -> SqlWriteT m Int64
- insertSelectDistinct :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m ()
- insertSelect :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m ()
- insertSelectCount :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m Int64
- unsafeSqlCase :: PersistField a => [(SqlExpr (Value Bool), SqlExpr (Value a))] -> SqlExpr (Value a) -> SqlExpr (Value a)
- unsafeSqlBinOp :: Builder -> SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value c)
- unsafeSqlBinOpComposite :: Builder -> Builder -> SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value c)
- unsafeSqlValue :: Builder -> SqlExpr (Value a)
- unsafeSqlFunction :: UnsafeSqlFunctionArgument a => Builder -> a -> SqlExpr (Value b)
- unsafeSqlExtractSubField :: UnsafeSqlFunctionArgument a => Builder -> a -> SqlExpr (Value b)
- class UnsafeSqlFunctionArgument a
- rawSelectSource :: (SqlSelect a r, MonadIO m1, MonadIO m2) => Mode -> SqlQuery a -> SqlReadT m1 (Acquire (Source m2 r))
- runSource :: Monad m => Source (ReaderT backend m) r -> ReaderT backend m [r]
- rawEsqueleto :: (MonadIO m, SqlSelect a r, IsSqlBackend backend) => Mode -> SqlQuery a -> ReaderT backend m Int64
- toRawSql :: (IsSqlBackend backend, SqlSelect a r) => Mode -> (backend, IdentState) -> SqlQuery a -> (Builder, [PersistValue])
- data Mode
  - = SELECT
  - | DELETE
  - | UPDATE
  - | INSERT_INTO
- data IdentState
- initialIdentState :: IdentState
- type IdentInfo = (SqlBackend, IdentState)
- class SqlSelect a r | a -> r, r -> a where
- veryUnsafeCoerceSqlExprValue :: SqlExpr (Value a) -> SqlExpr (Value b)
- veryUnsafeCoerceSqlExprValueList :: SqlExpr (ValueList a) -> SqlExpr (Value a)

# The pretty face

data SqlQuery a #

SQL backend for `esqueleto` using `SqlPersistT`.

Instances

Monad SqlQuery # |
Methods (>>=) :: SqlQuery a -> (a -> SqlQuery b) -> SqlQuery b # (>>) :: SqlQuery a -> SqlQuery b -> SqlQuery b # return :: a -> SqlQuery a # fail :: String -> SqlQuery a #
Functor SqlQuery # |
Methods fmap :: (a -> b) -> SqlQuery a -> SqlQuery b # (<$) :: a -> SqlQuery b -> SqlQuery a #
Applicative SqlQuery # |
Methods pure :: a -> SqlQuery a # (<*>) :: SqlQuery (a -> b) -> SqlQuery a -> SqlQuery b # (*>) :: SqlQuery a -> SqlQuery b -> SqlQuery b # (<*) :: SqlQuery a -> SqlQuery b -> SqlQuery a #
Esqueleto SqlQuery SqlExpr SqlBackend # |
Methods fromStart :: (PersistEntity a, (* ~ PersistEntityBackend a) SqlBackend) => SqlQuery (SqlExpr (PreprocessedFrom (SqlExpr (Entity a)))) # fromStartMaybe :: (PersistEntity a, (* ~ PersistEntityBackend a) SqlBackend) => SqlQuery (SqlExpr (PreprocessedFrom (SqlExpr (Maybe (Entity a))))) # fromJoin :: IsJoinKind join => SqlExpr (PreprocessedFrom a) -> SqlExpr (PreprocessedFrom b) -> SqlQuery (SqlExpr (PreprocessedFrom (join a b))) # fromFinish :: SqlExpr (PreprocessedFrom a) -> SqlQuery a # where_ :: SqlExpr (Value Bool) -> SqlQuery () # on :: SqlExpr (Value Bool) -> SqlQuery () # groupBy :: ToSomeValues SqlExpr a => a -> SqlQuery () # orderBy :: [SqlExpr OrderBy] -> SqlQuery () # asc :: PersistField a => SqlExpr (Value a) -> SqlExpr OrderBy # desc :: PersistField a => SqlExpr (Value a) -> SqlExpr OrderBy # limit :: Int64 -> SqlQuery () # offset :: Int64 -> SqlQuery () # distinct :: SqlQuery a -> SqlQuery a # distinctOn :: [SqlExpr DistinctOn] -> SqlQuery a -> SqlQuery a # don :: SqlExpr (Value a) -> SqlExpr DistinctOn # distinctOnOrderBy :: [SqlExpr OrderBy] -> SqlQuery a -> SqlQuery a # rand :: SqlExpr OrderBy # having :: SqlExpr (Value Bool) -> SqlQuery () # locking :: LockingKind -> SqlQuery () # sub_select :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (Value a) # sub_selectDistinct :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (Value a) # (^.) :: (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) # (?.) :: (PersistEntity val, PersistField typ) => SqlExpr (Maybe (Entity val)) -> EntityField val typ -> SqlExpr (Value (Maybe typ)) # val :: PersistField typ => typ -> SqlExpr (Value typ) # isNothing :: PersistField typ => SqlExpr (Value (Maybe typ)) -> SqlExpr (Value Bool) # just :: SqlExpr (Value typ) -> SqlExpr (Value (Maybe typ)) # nothing :: SqlExpr (Value (Maybe typ)) # joinV :: SqlExpr (Value (Maybe (Maybe typ))) -> SqlExpr (Value (Maybe typ)) # countRows :: Num a => SqlExpr (Value a) # count :: Num a => SqlExpr (Value typ) -> SqlExpr (Value a) # countDistinct :: Num a => SqlExpr (Value typ) -> SqlExpr (Value a) # not_ :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (==.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (>=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (>.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (<=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (<.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (!=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (&&.) :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (||.) :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (+.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (-.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (/.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (*.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # random_ :: (PersistField a, Num a) => SqlExpr (Value a) # round_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # ceiling_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # floor_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # sum_ :: (PersistField a, PersistField b) => SqlExpr (Value a) -> SqlExpr (Value (Maybe b)) # min_ :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value (Maybe a)) # max_ :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value (Maybe a)) # avg_ :: (PersistField a, PersistField b) => SqlExpr (Value a) -> SqlExpr (Value (Maybe b)) # castNum :: (Num a, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # castNumM :: (Num a, Num b) => SqlExpr (Value (Maybe a)) -> SqlExpr (Value (Maybe b)) # coalesce :: PersistField a => [SqlExpr (Value (Maybe a))] -> SqlExpr (Value (Maybe a)) # coalesceDefault :: PersistField a => [SqlExpr (Value (Maybe a))] -> SqlExpr (Value a) -> SqlExpr (Value a) # lower_ :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) # like :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value Bool) # ilike :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value Bool) # (%) :: SqlString s => SqlExpr (Value s) # concat_ :: SqlString s => [SqlExpr (Value s)] -> SqlExpr (Value s) # (++.) :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value s) # castString :: (SqlString s, SqlString r) => SqlExpr (Value s) -> SqlExpr (Value r) # subList_select :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a) # subList_selectDistinct :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a) # valList :: PersistField typ => [typ] -> SqlExpr (ValueList typ) # justList :: SqlExpr (ValueList typ) -> SqlExpr (ValueList (Maybe typ)) # in_ :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (ValueList typ) -> SqlExpr (Value Bool) # notIn :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (ValueList typ) -> SqlExpr (Value Bool) # exists :: SqlQuery () -> SqlExpr (Value Bool) # notExists :: SqlQuery () -> SqlExpr (Value Bool) # set :: PersistEntity val => SqlExpr (Entity val) -> [SqlExpr (Update val)] -> SqlQuery () # (=.) :: (PersistEntity val, PersistField typ) => EntityField val typ -> SqlExpr (Value typ) -> SqlExpr (Update val) # (+=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (-=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (*=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (/=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (<#) :: (a -> b) -> SqlExpr (Value a) -> SqlExpr (Insertion b) # (<&>) :: SqlExpr (Insertion (a -> b)) -> SqlExpr (Value a) -> SqlExpr (Insertion b) # case_ :: PersistField a => [(SqlExpr (Value Bool), SqlExpr (Value a))] -> SqlExpr (Value a) -> SqlExpr (Value a) # toBaseId :: ToBaseId ent => SqlExpr (Value (Key ent)) -> SqlExpr (Value (Key (BaseEnt ent))) #

data SqlExpr a #

An expression on the SQL backend.

There are many comments describing the constructors of this data type. However, Haddock doesn't like GADTs, so you'll have to read them by hitting "Source".

Instances

Esqueleto SqlQuery SqlExpr SqlBackend # |
Methods fromStart :: (PersistEntity a, (* ~ PersistEntityBackend a) SqlBackend) => SqlQuery (SqlExpr (PreprocessedFrom (SqlExpr (Entity a)))) # fromStartMaybe :: (PersistEntity a, (* ~ PersistEntityBackend a) SqlBackend) => SqlQuery (SqlExpr (PreprocessedFrom (SqlExpr (Maybe (Entity a))))) # fromJoin :: IsJoinKind join => SqlExpr (PreprocessedFrom a) -> SqlExpr (PreprocessedFrom b) -> SqlQuery (SqlExpr (PreprocessedFrom (join a b))) # fromFinish :: SqlExpr (PreprocessedFrom a) -> SqlQuery a # where_ :: SqlExpr (Value Bool) -> SqlQuery () # on :: SqlExpr (Value Bool) -> SqlQuery () # groupBy :: ToSomeValues SqlExpr a => a -> SqlQuery () # orderBy :: [SqlExpr OrderBy] -> SqlQuery () # asc :: PersistField a => SqlExpr (Value a) -> SqlExpr OrderBy # desc :: PersistField a => SqlExpr (Value a) -> SqlExpr OrderBy # limit :: Int64 -> SqlQuery () # offset :: Int64 -> SqlQuery () # distinct :: SqlQuery a -> SqlQuery a # distinctOn :: [SqlExpr DistinctOn] -> SqlQuery a -> SqlQuery a # don :: SqlExpr (Value a) -> SqlExpr DistinctOn # distinctOnOrderBy :: [SqlExpr OrderBy] -> SqlQuery a -> SqlQuery a # rand :: SqlExpr OrderBy # having :: SqlExpr (Value Bool) -> SqlQuery () # locking :: LockingKind -> SqlQuery () # sub_select :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (Value a) # sub_selectDistinct :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (Value a) # (^.) :: (PersistEntity val, PersistField typ) => SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ) # (?.) :: (PersistEntity val, PersistField typ) => SqlExpr (Maybe (Entity val)) -> EntityField val typ -> SqlExpr (Value (Maybe typ)) # val :: PersistField typ => typ -> SqlExpr (Value typ) # isNothing :: PersistField typ => SqlExpr (Value (Maybe typ)) -> SqlExpr (Value Bool) # just :: SqlExpr (Value typ) -> SqlExpr (Value (Maybe typ)) # nothing :: SqlExpr (Value (Maybe typ)) # joinV :: SqlExpr (Value (Maybe (Maybe typ))) -> SqlExpr (Value (Maybe typ)) # countRows :: Num a => SqlExpr (Value a) # count :: Num a => SqlExpr (Value typ) -> SqlExpr (Value a) # countDistinct :: Num a => SqlExpr (Value typ) -> SqlExpr (Value a) # not_ :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (==.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (>=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (>.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (<=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (<.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (!=.) :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (Value typ) -> SqlExpr (Value Bool) # (&&.) :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (||.) :: SqlExpr (Value Bool) -> SqlExpr (Value Bool) -> SqlExpr (Value Bool) # (+.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (-.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (/.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # (*.) :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value a) # random_ :: (PersistField a, Num a) => SqlExpr (Value a) # round_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # ceiling_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # floor_ :: (PersistField a, Num a, PersistField b, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # sum_ :: (PersistField a, PersistField b) => SqlExpr (Value a) -> SqlExpr (Value (Maybe b)) # min_ :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value (Maybe a)) # max_ :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value (Maybe a)) # avg_ :: (PersistField a, PersistField b) => SqlExpr (Value a) -> SqlExpr (Value (Maybe b)) # castNum :: (Num a, Num b) => SqlExpr (Value a) -> SqlExpr (Value b) # castNumM :: (Num a, Num b) => SqlExpr (Value (Maybe a)) -> SqlExpr (Value (Maybe b)) # coalesce :: PersistField a => [SqlExpr (Value (Maybe a))] -> SqlExpr (Value (Maybe a)) # coalesceDefault :: PersistField a => [SqlExpr (Value (Maybe a))] -> SqlExpr (Value a) -> SqlExpr (Value a) # lower_ :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) # like :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value Bool) # ilike :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value Bool) # (%) :: SqlString s => SqlExpr (Value s) # concat_ :: SqlString s => [SqlExpr (Value s)] -> SqlExpr (Value s) # (++.) :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value s) # castString :: (SqlString s, SqlString r) => SqlExpr (Value s) -> SqlExpr (Value r) # subList_select :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a) # subList_selectDistinct :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a) # valList :: PersistField typ => [typ] -> SqlExpr (ValueList typ) # justList :: SqlExpr (ValueList typ) -> SqlExpr (ValueList (Maybe typ)) # in_ :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (ValueList typ) -> SqlExpr (Value Bool) # notIn :: PersistField typ => SqlExpr (Value typ) -> SqlExpr (ValueList typ) -> SqlExpr (Value Bool) # exists :: SqlQuery () -> SqlExpr (Value Bool) # notExists :: SqlQuery () -> SqlExpr (Value Bool) # set :: PersistEntity val => SqlExpr (Entity val) -> [SqlExpr (Update val)] -> SqlQuery () # (=.) :: (PersistEntity val, PersistField typ) => EntityField val typ -> SqlExpr (Value typ) -> SqlExpr (Update val) # (+=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (-=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (*=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (/=.) :: (PersistEntity val, PersistField a) => EntityField val a -> SqlExpr (Value a) -> SqlExpr (Update val) # (<#) :: (a -> b) -> SqlExpr (Value a) -> SqlExpr (Insertion b) # (<&>) :: SqlExpr (Insertion (a -> b)) -> SqlExpr (Value a) -> SqlExpr (Insertion b) # case_ :: PersistField a => [(SqlExpr (Value Bool), SqlExpr (Value a))] -> SqlExpr (Value a) -> SqlExpr (Value a) # toBaseId :: ToBaseId ent => SqlExpr (Value (Key ent)) -> SqlExpr (Value (Key (BaseEnt ent))) #
ToSomeValues SqlExpr (SqlExpr (Value a)) # |
Methods toSomeValues :: SqlExpr (Value a) -> [SomeValue SqlExpr] #
(~) * a (Value b) => UnsafeSqlFunctionArgument (SqlExpr a) # |
Methods toArgList :: SqlExpr a -> [SqlExpr (Value ())]
PersistEntity a => SqlSelect (SqlExpr (Maybe (Entity a))) (Maybe (Entity a)) # | You may return a possibly-`NULL` `Entity` from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Maybe (Entity a)) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Maybe (Entity a))) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Maybe (Entity a)) # sqlInsertInto :: IdentInfo -> SqlExpr (Maybe (Entity a)) -> (Builder, [PersistValue]) #
PersistEntity a => SqlSelect (SqlExpr (Entity a)) (Entity a) # | You may return an `Entity` from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Entity a) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Entity a)) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Entity a) # sqlInsertInto :: IdentInfo -> SqlExpr (Entity a) -> (Builder, [PersistValue]) #
PersistField a => SqlSelect (SqlExpr (Value a)) (Value a) # | You may return any single value (i.e. a single column) from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Value a) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Value a)) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Value a) # sqlInsertInto :: IdentInfo -> SqlExpr (Value a) -> (Builder, [PersistValue]) #

type SqlEntity ent = (PersistEntity ent, PersistEntityBackend ent ~ SqlBackend) #

Constraint synonym for `persistent` entities whose backend is `SqlPersistT`.

select :: (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlReadT m [r] #

Execute an `esqueleto` `SELECT` query inside `persistent`'s `SqlPersistT` monad and return a list of rows.

We've seen that `from` has some magic about which kinds of things you may bring into scope. This `select` function also has some magic for which kinds of things you may bring back to Haskell-land by using `SqlQuery`'s `return`:

- You may return a `SqlExpr (`Entity` v)` for an entity `v` (i.e., like the `*` in SQL), which is then returned to Haskell-land as just `Entity v`.
- You may return a `SqlExpr (Maybe (Entity v))` for an entity `v` that may be `NULL`, which is then returned to Haskell-land as `Maybe (Entity v)`. Used for `OUTER JOIN`s.
- You may return a `SqlExpr (`Value` t)` for a value `t` (i.e., a single column), where `t` is any instance of `PersistField`, which is then returned to Haskell-land as `Value t`. You may use `Value` to return projections of an `Entity` (see `(`^.`)` and `(`?.`)`) or to return any other value calculated on the query (e.g., `countRows` or `sub_select`).

The `SqlSelect a r` class has functional dependencies that allow type information to flow both from `a` to `r` and vice-versa. This means that you'll almost never have to give any type signatures for `esqueleto` queries. For example, the query ``select` $ from $ \p -> return p` alone is ambiguous, but in the context of

    do ps <- select $
             from $ \p ->
             return p
       liftIO $ mapM_ (putStrLn . personName . entityVal) ps

we are able to infer from that single `personName . entityVal` function composition that the `p` inside the query is of type `SqlExpr (Entity Person)`.

selectSource :: (SqlSelect a r, MonadResource m) => SqlQuery a -> Source (SqlPersistT m) r #

Execute an `esqueleto` `SELECT` query inside `persistent`'s `SqlPersistT` monad and return a `Source` of rows.

selectDistinct :: (SqlSelect a r, MonadIO m) => SqlQuery a -> SqlPersistT m [r] #

Deprecated: Since 2.2.4: use `select` and `distinct`.

Execute an `esqueleto` `SELECT DISTINCT` query inside `persistent`'s `SqlPersistT` monad and return a list of rows.

selectDistinctSource :: (SqlSelect a r, MonadResource m) => SqlQuery a -> Source (SqlPersistT m) r #

Deprecated: Since 2.2.4: use `selectSource` and `distinct`.

Execute an `esqueleto` `SELECT DISTINCT` query inside `persistent`'s `SqlPersistT` monad and return a `Source` of rows.

delete :: MonadIO m => SqlQuery () -> SqlWriteT m () #

Execute an `esqueleto` `DELETE` query inside `persistent`'s `SqlPersistT` monad. Note that currently there are no type checks for statements that should not appear on a `DELETE` query.

Example of usage:

    delete $
    from $ \appointment ->
    where_ (appointment ^. AppointmentDate <. val now)

Unlike `select`, there is a useful way of using `delete` that will lead to type ambiguities. If you want to delete all rows (i.e., no `where_` clause), you'll have to use a type signature:

    delete $
    from $ \(appointment :: SqlExpr (Entity Appointment)) ->
    return ()

deleteCount :: MonadIO m => SqlQuery () -> SqlWriteT m Int64 #

Same as `delete`, but returns the number of rows affected.

update :: (MonadIO m, SqlEntity val) => (SqlExpr (Entity val) -> SqlQuery ()) -> SqlWriteT m () #

Execute an `esqueleto` `UPDATE` query inside `persistent`'s `SqlPersistT` monad. Note that currently there are no type checks for statements that should not appear on a `UPDATE` query.

Example of usage:

    update $ \p -> do
    set p [ PersonAge =. just (val thisYear) -. p ^. PersonBorn ]
    where_ $ isNothing (p ^. PersonAge)

updateCount :: (MonadIO m, SqlEntity val) => (SqlExpr (Entity val) -> SqlQuery ()) -> SqlWriteT m Int64 #

Same as `update`, but returns the number of rows affected.

insertSelectDistinct :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m () #

Deprecated: Since 2.2.4: use `insertSelect` and `distinct`.

Insert a `PersistField` for every unique selected value.

insertSelect :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m () #

Insert a `PersistField` for every selected value.

Since: 2.4.2

insertSelectCount :: (MonadIO m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> SqlWriteT m Int64 #

Insert a `PersistField` for every selected value, return the count afterward

# The guts

unsafeSqlCase :: PersistField a => [(SqlExpr (Value Bool), SqlExpr (Value a))] -> SqlExpr (Value a) -> SqlExpr (Value a) #

(Internal) Create a case statement.

Since: 2.1.1

unsafeSqlBinOp :: Builder -> SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value c) #

(Internal) Create a custom binary operator. You should not use this function directly since its type is very general, you should always use it with an explicit type signature. For example:

    (==.) :: SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value Bool)
    (==.) = unsafeSqlBinOp " = "

In the example above, we constraint the arguments to be of the same type and constraint the result to be a boolean value.

unsafeSqlBinOpComposite :: Builder -> Builder -> SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value c) #

Similar to `unsafeSqlBinOp`, but may also be applied to composite keys. Uses the operator given as the second argument whenever applied to composite keys.

Usage example:

    (==.) :: SqlExpr (Value a) -> SqlExpr (Value a) -> SqlExpr (Value Bool)
    (==.) = unsafeSqlBinOpComposite " = " " AND "

Persistent has a hack for implementing composite keys (see `ECompositeKey` doc for more details), so we're forced to use a hack here as well. We deconstruct `ERaw` values based on two rules:

- If it is a single placeholder, then it's assumed to be coming from a `PersistList` and thus its components are separated so that they may be applied to a composite key.
- If it is not a single placeholder, then it's assumed to be a foreign (composite or not) key, so we enforce that it has no placeholders and split it on the commas.

unsafeSqlValue :: Builder -> SqlExpr (Value a) #

(Internal) A raw SQL value. The same warning from `unsafeSqlBinOp` applies to this function as well.

unsafeSqlFunction :: UnsafeSqlFunctionArgument a => Builder -> a -> SqlExpr (Value b) #

(Internal) A raw SQL function. Once again, the same warning from `unsafeSqlBinOp` applies to this function as well.

unsafeSqlExtractSubField :: UnsafeSqlFunctionArgument a => Builder -> a -> SqlExpr (Value b) #

(Internal) An unsafe SQL function to extract a subfield from a compound field, e.g. datetime. See `unsafeSqlBinOp` for warnings.

Since: 1.3.6.

class UnsafeSqlFunctionArgument a #

Minimal complete definition

toArgList

Instances

UnsafeSqlFunctionArgument a => UnsafeSqlFunctionArgument [a] # |
Methods toArgList :: [a] -> [SqlExpr (Value ())]
(~) * a (Value b) => UnsafeSqlFunctionArgument (SqlExpr a) # |
Methods toArgList :: SqlExpr a -> [SqlExpr (Value ())]
(UnsafeSqlFunctionArgument a, UnsafeSqlFunctionArgument b) => UnsafeSqlFunctionArgument (a, b) # |
Methods toArgList :: (a, b) -> [SqlExpr (Value ())]
(UnsafeSqlFunctionArgument a, UnsafeSqlFunctionArgument b, UnsafeSqlFunctionArgument c) => UnsafeSqlFunctionArgument (a, b, c) # |
Methods toArgList :: (a, b, c) -> [SqlExpr (Value ())]
(UnsafeSqlFunctionArgument a, UnsafeSqlFunctionArgument b, UnsafeSqlFunctionArgument c, UnsafeSqlFunctionArgument d) => UnsafeSqlFunctionArgument (a, b, c, d) # |
Methods toArgList :: (a, b, c, d) -> [SqlExpr (Value ())]

rawSelectSource :: (SqlSelect a r, MonadIO m1, MonadIO m2) => Mode -> SqlQuery a -> SqlReadT m1 (Acquire (Source m2 r)) #

(Internal) Execute an `esqueleto` `SELECT` `SqlQuery` inside `persistent`'s `SqlPersistT` monad.

runSource :: Monad m => Source (ReaderT backend m) r -> ReaderT backend m [r] #

(Internal) Run a `Source` of rows.

rawEsqueleto :: (MonadIO m, SqlSelect a r, IsSqlBackend backend) => Mode -> SqlQuery a -> ReaderT backend m Int64 #

(Internal) Execute an `esqueleto` statement inside `persistent`'s `SqlPersistT` monad.

toRawSql :: (IsSqlBackend backend, SqlSelect a r) => Mode -> (backend, IdentState) -> SqlQuery a -> (Builder, [PersistValue]) #

(Internal) Pretty prints a `SqlQuery` into a SQL query.

Note: if you're curious about the SQL query being generated by `esqueleto`, instead of manually using this function (which is possible but tedious), you may just turn on query logging of `persistent`.

data Mode #

(Internal) Mode of query being converted by `toRawSql`.

Constructors

SELECT |
DELETE |
UPDATE |
INSERT_INTO |

data IdentState #

List of identifiers already in use and supply of temporary identifiers.

initialIdentState :: IdentState #

type IdentInfo = (SqlBackend, IdentState) #

Information needed to escape and use identifiers.

class SqlSelect a r | a -> r, r -> a where #

(Internal) Class for mapping results coming from `SqlQuery` into actual results.

This looks very similar to `RawSql`, and it is! However, there are some crucial differences and ultimately they're different classes.

Minimal complete definition

sqlSelectCols, sqlSelectColCount, sqlSelectProcessRow

Methods

sqlSelectCols :: IdentInfo -> a -> (Builder, [PersistValue]) #

Creates the variable part of the `SELECT` query and returns the list of `PersistValue`s that will be given to `rawQuery`.

sqlSelectColCount :: Proxy a -> Int #

Number of columns that will be consumed.

sqlSelectProcessRow :: [PersistValue] -> Either Text r #

Transform a row of the result into the data type.

sqlInsertInto :: IdentInfo -> a -> (Builder, [PersistValue]) #

Create `INSERT INTO` clause instead.

Instances

SqlSelect () () # | Not useful for `select`, but used for `update` and `delete`.
Methods sqlSelectCols :: IdentInfo -> () -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * () -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text () # sqlInsertInto :: IdentInfo -> () -> (Builder, [PersistValue]) #
PersistEntity a => SqlSelect (SqlExpr (Maybe (Entity a))) (Maybe (Entity a)) # | You may return a possibly-`NULL` `Entity` from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Maybe (Entity a)) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Maybe (Entity a))) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Maybe (Entity a)) # sqlInsertInto :: IdentInfo -> SqlExpr (Maybe (Entity a)) -> (Builder, [PersistValue]) #
PersistEntity a => SqlSelect (SqlExpr (Entity a)) (Entity a) # | You may return an `Entity` from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Entity a) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Entity a)) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Entity a) # sqlInsertInto :: IdentInfo -> SqlExpr (Entity a) -> (Builder, [PersistValue]) #
PersistField a => SqlSelect (SqlExpr (Value a)) (Value a) # | You may return any single value (i.e. a single column) from a `select` query.
Methods sqlSelectCols :: IdentInfo -> SqlExpr (Value a) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (SqlExpr (Value a)) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (Value a) # sqlInsertInto :: IdentInfo -> SqlExpr (Value a) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb) => SqlSelect (a, b) (ra, rb) # | You may return tuples (up to 16-tuples) and tuples of tuples from a `select` query.
Methods sqlSelectCols :: IdentInfo -> (a, b) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb) # sqlInsertInto :: IdentInfo -> (a, b) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc) => SqlSelect (a, b, c) (ra, rb, rc) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc) # sqlInsertInto :: IdentInfo -> (a, b, c) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd) => SqlSelect (a, b, c, d) (ra, rb, rc, rd) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd) # sqlInsertInto :: IdentInfo -> (a, b, c, d) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re) => SqlSelect (a, b, c, d, e) (ra, rb, rc, rd, re) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf) => SqlSelect (a, b, c, d, e, f) (ra, rb, rc, rd, re, rf) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg) => SqlSelect (a, b, c, d, e, f, g) (ra, rb, rc, rd, re, rf, rg) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh) => SqlSelect (a, b, c, d, e, f, g, h) (ra, rb, rc, rd, re, rf, rg, rh) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri) => SqlSelect (a, b, c, d, e, f, g, h, i) (ra, rb, rc, rd, re, rf, rg, rh, ri) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj) => SqlSelect (a, b, c, d, e, f, g, h, i, j) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk, SqlSelect l rl) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k, l) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k, l) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk, SqlSelect l rl, SqlSelect m rm) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k, l, m) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk, SqlSelect l rl, SqlSelect m rm, SqlSelect n rn) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk, SqlSelect l rl, SqlSelect m rm, SqlSelect n rn, SqlSelect o ro) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (Builder, [PersistValue]) #
(SqlSelect a ra, SqlSelect b rb, SqlSelect c rc, SqlSelect d rd, SqlSelect e re, SqlSelect f rf, SqlSelect g rg, SqlSelect h rh, SqlSelect i ri, SqlSelect j rj, SqlSelect k rk, SqlSelect l rl, SqlSelect m rm, SqlSelect n rn, SqlSelect o ro, SqlSelect p rp) => SqlSelect (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro, rp) # |
Methods sqlSelectCols :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> (Builder, [PersistValue]) # sqlSelectColCount :: Proxy * (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> Int # sqlSelectProcessRow :: [PersistValue] -> Either Text (ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro, rp) # sqlInsertInto :: IdentInfo -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> (Builder, [PersistValue]) #

veryUnsafeCoerceSqlExprValue :: SqlExpr (Value a) -> SqlExpr (Value b) #

(Internal) Coerce a value's type from 'SqlExpr (Value a)' to 'SqlExpr (Value b)'. You should not use this function unless you know what you're doing!

veryUnsafeCoerceSqlExprValueList :: SqlExpr (ValueList a) -> SqlExpr (Value a) #

(Internal) Coerce a value's type from 'SqlExpr (ValueList a)' to 'SqlExpr (Value a)'. Does not work with empty lists.