Skip to content

Commit 90928ea

Browse files
Update exists?/2 docs (#4538)
1 parent a54d96f commit 90928ea

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/ecto/query.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ defmodule Ecto.Query do
595595
conditions = dynamic([q], q.some_condition and ^conditions)
596596
from query, where: ^conditions
597597
598-
> ### Dynamic boundaries {: .warning}
598+
> #### Dynamic boundaries {: .warning}
599599
>
600600
> Type casting does not cross dynamic boundaries. When you write
601601
> a dynamic expression, such as `dynamic([p], p.visits > ^param)`,
@@ -1031,7 +1031,7 @@ defmodule Ecto.Query do
10311031
from p in Post,
10321032
hints: ["TABLESAMPLE", unsafe_fragment(^sample)]
10331033
1034-
> ### Unsafe Fragments {: .warning}
1034+
> #### Unsafe Fragments {: .warning}
10351035
>
10361036
> The output of `unsafe_fragment/1` will be injected directly into the
10371037
> resulting SQL statement without being escaped. For this reason, input
@@ -1283,7 +1283,7 @@ defmodule Ecto.Query do
12831283
after the join. In the expression syntax, the options are given as
12841284
the fifth argument.
12851285
1286-
> ### Unspecified join condition {: .warning}
1286+
> #### Unspecified join condition {: .warning}
12871287
>
12881288
> Leaving the `:on` option unspecified while performing a join
12891289
> that is not a cross join will trigger a warning. This is to

lib/ecto/repo.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ defmodule Ecto.Repo do
10441044
) :: term | nil
10451045

10461046
@doc """
1047-
Checks if there exists an entry that matches the given query.
1047+
Checks if there exists an entry that matches the given queryable.
10481048
10491049
Returns a boolean.
10501050
@@ -1060,6 +1060,13 @@ defmodule Ecto.Repo do
10601060
See the ["Shared options"](#module-shared-options) section at the module
10611061
documentation for more options.
10621062
1063+
> #### Generated Query {: .info}
1064+
>
1065+
> Ecto will take the provided queryable and modify it to reduce its footprint
1066+
> as much as possible. For example, by forcing `SELECT 1` and `LIMIT 1`. Any
1067+
> additional filtering must be provided directly on the queryable using expressions
1068+
> such as `where` and `having`.
1069+
10631070
## Examples
10641071
10651072
# checks if any posts exist

0 commit comments

Comments
 (0)