Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
esqueleto Database.Esqueleto.Internal.Internal Performs a sub-select using the given foreign key on the entity. This is useful to extract values that are known to be present by the database schema. As an example, consider the following persistent definition:
User profile ProfileId Profile name Text
The following query will return the name of the user.getUserWithName = select $ from $ user -> pure (user, subSelectForeign user UserProfile (^. ProfileName)
subSelectList :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a)esqueleto Database.Esqueleto.Internal.Internal Execute a subquery SELECT in a SqlExpr that returns a list. This is an alias for subList_select and is provided for symmetry with the other safe subselect functions.
-
esqueleto Database.Esqueleto.Internal.Internal Execute a subquery SELECT in a SqlExpr. This function is a shorthand for the common joinV . subSelect idiom, where you are calling subSelect on an expression that would be Maybe already. As an example, you would use this function when calling sum_ or max_, which have Maybe in the result type (for a 0 row query).
subSelectUnsafe :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (Value a)esqueleto Database.Esqueleto.Internal.Internal Execute a subquery SELECT in a SqlExpr. This function is unsafe, because it can throw runtime exceptions in two cases:
- If the query passed has 0 result rows, then it will return a NULL value. The persistent parsing operations will fail on an unexpected NULL.
- If the query passed returns more than one row, then the SQL engine will fail with an error like "More than one row returned by a subquery used as an expression".
-
esqueleto Database.Esqueleto.Legacy Insert a PersistField for every selected value.
-
esqueleto Database.Esqueleto.Legacy Insert a PersistField for every selected value, return the count afterward
-
esqueleto Database.Esqueleto.Legacy Renders a SqlQuery into a Text value along with the list of PersistValues that would be supplied to the database for ? placeholders.
subList_select :: PersistField a => SqlQuery (SqlExpr (Value a)) -> SqlExpr (ValueList a)esqueleto Database.Esqueleto.Legacy Execute a subquery SELECT in an SqlExpression. Returns a list of values.
-
esqueleto Database.Esqueleto.Legacy Execute a subquery SELECT in a SqlExpr. The query passed to this function will only return a single result - it has a LIMIT 1 passed in to the query to make it safe, and the return type is Maybe to indicate that the subquery might result in 0 rows. If you find yourself writing joinV . subSelect, then consider using subSelectMaybe. If you're performing a countRows, then you can use subSelectCount which is safe. If you know that the subquery will always return exactly one row (eg a foreign key constraint guarantees that you'll get exactly one row), then consider subSelectUnsafe, along with a comment explaining why it is safe.
subSelectCount :: (Num a, PersistField a) => SqlQuery ignored -> SqlExpr (Value a)esqueleto Database.Esqueleto.Legacy Performs a COUNT of the given query in a subSelect manner. This is always guaranteed to return a result value, and is completely safe.