mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-17 11:04:22 +01:00
remove Repo.isolated_transaction/2
This commit is contained in:
parent
da1e6a145d
commit
2913da2692
1 changed files with 0 additions and 20 deletions
|
@ -1,27 +1,7 @@
|
||||||
defmodule Philomena.Repo do
|
defmodule Philomena.Repo do
|
||||||
alias Ecto.Multi
|
|
||||||
|
|
||||||
use Ecto.Repo,
|
use Ecto.Repo,
|
||||||
otp_app: :philomena,
|
otp_app: :philomena,
|
||||||
adapter: Ecto.Adapters.Postgres
|
adapter: Ecto.Adapters.Postgres
|
||||||
|
|
||||||
use Scrivener, page_size: 250
|
use Scrivener, page_size: 250
|
||||||
|
|
||||||
@levels %{
|
|
||||||
read_committed: "READ COMMITTED",
|
|
||||||
repeatable_read: "REPEATABLE READ",
|
|
||||||
serializable: "SERIALIZABLE"
|
|
||||||
}
|
|
||||||
|
|
||||||
def isolated_transaction(%Multi{} = multi, level) do
|
|
||||||
Multi.append(
|
|
||||||
Multi.new()
|
|
||||||
|> Multi.run(:isolate, fn repo, _chg ->
|
|
||||||
repo.query!("SET TRANSACTION ISOLATION LEVEL #{@levels[level]}")
|
|
||||||
{:ok, nil}
|
|
||||||
end),
|
|
||||||
multi
|
|
||||||
)
|
|
||||||
|> Philomena.Repo.transaction()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue