Skip to content

Commit 2ffda89

Browse files
authored
Update Repo Documentation: Paranthesis on function calls (#4657)
1 parent baa1a9b commit 2ffda89

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/ecto/repo.ex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,15 @@ defmodule Ecto.Repo do
774774
775775
## Examples
776776
777-
MyRepo.checked_out?
777+
MyRepo.checked_out?()
778778
#=> false
779779
780780
MyRepo.transact(fn ->
781-
MyRepo.checked_out? #=> true
781+
MyRepo.checked_out?() #=> true
782782
end)
783783
784784
MyRepo.checkout(fn ->
785-
MyRepo.checked_out? #=> true
785+
MyRepo.checked_out?() #=> true
786786
end)
787787
788788
"""
@@ -1856,7 +1856,7 @@ defmodule Ecto.Repo do
18561856
A typical example is calling `MyRepo.insert/1` with a struct
18571857
and acting on the return value:
18581858
1859-
case MyRepo.insert %Post{title: "Ecto is great"} do
1859+
case MyRepo.insert(%Post{title: "Ecto is great"}) do
18601860
{:ok, struct} -> # Inserted with success
18611861
{:error, changeset} -> # Something went wrong
18621862
end
@@ -2055,8 +2055,8 @@ defmodule Ecto.Repo do
20552055
## Example
20562056
20572057
post = MyRepo.get!(Post, 42)
2058-
post = Ecto.Changeset.change post, title: "New title"
2059-
case MyRepo.update post do
2058+
post = Ecto.Changeset.change(post, title: "New title")
2059+
case MyRepo.update(post) do
20602060
{:ok, struct} -> # Updated with success
20612061
{:error, changeset} -> # Something went wrong
20622062
end
@@ -2077,7 +2077,7 @@ defmodule Ecto.Repo do
20772077
the database. So even if the struct exists, this won't work:
20782078
20792079
struct = %Post{id: "existing_id", ...}
2080-
MyRepo.insert_or_update changeset
2080+
MyRepo.insert_or_update(changeset)
20812081
# => {:error, changeset} # id already exists
20822082
20832083
## Options
@@ -2107,7 +2107,7 @@ defmodule Ecto.Repo do
21072107
post -> post # Post exists, let's use it
21082108
end
21092109
|> Post.changeset(changes)
2110-
|> MyRepo.insert_or_update
2110+
|> MyRepo.insert_or_update()
21112111
21122112
case result do
21132113
{:ok, struct} -> # Inserted or updated with success
@@ -2166,7 +2166,7 @@ defmodule Ecto.Repo do
21662166
## Example
21672167
21682168
post = MyRepo.get!(Post, 42)
2169-
case MyRepo.delete post do
2169+
case MyRepo.delete(post) do
21702170
{:ok, struct} -> # Deleted with success
21712171
{:error, changeset} -> # Something went wrong
21722172
end
@@ -2514,11 +2514,11 @@ defmodule Ecto.Repo do
25142514
25152515
## Examples
25162516
2517-
MyRepo.in_transaction?
2517+
MyRepo.in_transaction?()
25182518
#=> false
25192519
25202520
MyRepo.transact(fn ->
2521-
MyRepo.in_transaction? #=> true
2521+
MyRepo.in_transaction?() #=> true
25222522
end)
25232523
25242524
"""

0 commit comments

Comments
 (0)