Hoogle Search

Within LTS Haskell 24.0 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. select :: forall a r (m :: Type -> Type) backend . (SqlSelect a r, MonadIO m, SqlBackendCanRead backend) => SqlQuery a -> ReaderT backend m [r]

    esqueleto Database.Esqueleto

    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 JOINs.
    • 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 subSelect).
    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).

  2. select :: forall a r (m :: Type -> Type) backend . (SqlSelect a r, MonadIO m, SqlBackendCanRead backend) => SqlQuery a -> ReaderT backend m [r]

    esqueleto Database.Esqueleto.Experimental

    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 JOINs.
    • 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 subSelect).
    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).

  3. select :: forall a r (m :: Type -> Type) backend . (SqlSelect a r, MonadIO m, SqlBackendCanRead backend) => SqlQuery a -> ReaderT backend m [r]

    esqueleto Database.Esqueleto.Internal.Internal

    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 JOINs.
    • 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 subSelect).
    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).

  4. select :: forall a r (m :: Type -> Type) backend . (SqlSelect a r, MonadIO m, SqlBackendCanRead backend) => SqlQuery a -> ReaderT backend m [r]

    esqueleto Database.Esqueleto.Legacy

    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 JOINs.
    • 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 subSelect).
    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).

  5. SELECT :: Mode

    esqueleto Database.Esqueleto.Internal.Internal

    No documentation available.

  6. selectFirst :: forall (m :: Type -> Type) record . (PersistQueryRead backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m (Maybe (Entity record))

    esqueleto Database.Esqueleto

    Get just the first record for the criterion.

  7. selectKeys :: forall record backend (m :: Type -> Type) . (PersistQueryRead backend, MonadResource m, PersistRecordBackend record backend, MonadReader backend m) => [Filter record] -> [SelectOpt record] -> ConduitM () (Key record) m ()

    esqueleto Database.Esqueleto

    Get the Keys of all records matching the given criterion. For an example, see selectList.

  8. selectKeysRes :: forall (m1 :: Type -> Type) (m2 :: Type -> Type) record . (PersistQueryRead backend, MonadIO m1, MonadIO m2, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m1 (Acquire (ConduitM () (Key record) m2 ()))

    esqueleto Database.Esqueleto

    Get the Keys of all records matching the given criterion.

  9. selectOne :: forall a r (m :: Type -> Type) backend . (SqlSelect a r, MonadIO m, SqlBackendCanRead backend) => SqlQuery a -> ReaderT backend m (Maybe r)

    esqueleto Database.Esqueleto

    Execute an esqueleto SELECT query inside persistent's SqlPersistT monad and return the first entry wrapped in a Maybe. @since 3.5.1.0

    Example usage

    firstPerson :: MonadIO m => SqlPersistT m (Maybe (Entity Person))
    firstPerson =
    selectOne $ do
    person <- from $ table @Person
    return person
    
    The above query is equivalent to a select combined with limit but you would still have to transform the results from a list:
    firstPerson :: MonadIO m => SqlPersistT m [Entity Person]
    firstPerson =
    select $ do
    person <- from $ table @Person
    limit 1
    return person
    

  10. selectSource :: forall a r backend (m :: Type -> Type) . (SqlSelect a r, BackendCompatible SqlBackend backend, IsPersistBackend backend, PersistQueryRead backend, PersistStoreRead backend, PersistUniqueRead backend, MonadResource m) => SqlQuery a -> ConduitT () r (ReaderT backend m) ()

    esqueleto Database.Esqueleto

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

Page 1 of many | Next