Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exists?/2 docs #4538

Merged
merged 1 commit into from
Nov 2, 2024
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: 3 additions & 3 deletions lib/ecto/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ defmodule Ecto.Query do
conditions = dynamic([q], q.some_condition and ^conditions)
from query, where: ^conditions

> ### Dynamic boundaries {: .warning}
> #### Dynamic boundaries {: .warning}
>
> Type casting does not cross dynamic boundaries. When you write
> a dynamic expression, such as `dynamic([p], p.visits > ^param)`,
Expand Down Expand Up @@ -1031,7 +1031,7 @@ defmodule Ecto.Query do
from p in Post,
hints: ["TABLESAMPLE", unsafe_fragment(^sample)]

> ### Unsafe Fragments {: .warning}
> #### Unsafe Fragments {: .warning}
>
> The output of `unsafe_fragment/1` will be injected directly into the
> resulting SQL statement without being escaped. For this reason, input
Expand Down Expand Up @@ -1283,7 +1283,7 @@ defmodule Ecto.Query do
after the join. In the expression syntax, the options are given as
the fifth argument.

> ### Unspecified join condition {: .warning}
> #### Unspecified join condition {: .warning}
>
> Leaving the `:on` option unspecified while performing a join
> that is not a cross join will trigger a warning. This is to
Expand Down
9 changes: 8 additions & 1 deletion lib/ecto/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ defmodule Ecto.Repo do
) :: term | nil

@doc """
Checks if there exists an entry that matches the given query.
Checks if there exists an entry that matches the given queryable.

Returns a boolean.

Expand All @@ -1060,6 +1060,13 @@ defmodule Ecto.Repo do
See the ["Shared options"](#module-shared-options) section at the module
documentation for more options.

> #### Generated Query {: .info}
>
> Ecto will take the provided queryable and modify it to reduce its footprint
> as much as possible. For example, by forcing `SELECT 1` and `LIMIT 1`. Any
> additional filtering must be provided directly on the queryable using expressions
> such as `where` and `having`.

## Examples

# checks if any posts exist
Expand Down
Loading