zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

transaction.ex (921B)


      1 defmodule Ecto.Adapter.Transaction do
      2   @moduledoc """
      3   Specifies the adapter transactions API.
      4   """
      5 
      6   @type adapter_meta :: Ecto.Adapter.adapter_meta()
      7 
      8   @doc """
      9   Runs the given function inside a transaction.
     10 
     11   Returns `{:ok, value}` if the transaction was successful where `value`
     12   is the value return by the function or `{:error, value}` if the transaction
     13   was rolled back where `value` is the value given to `rollback/1`.
     14   """
     15   @callback transaction(adapter_meta, options :: Keyword.t(), function :: fun) ::
     16               {:ok, any} | {:error, any}
     17 
     18   @doc """
     19   Returns true if the given process is inside a transaction.
     20   """
     21   @callback in_transaction?(adapter_meta) :: boolean
     22 
     23   @doc """
     24   Rolls back the current transaction.
     25 
     26   The transaction will return the value given as `{:error, value}`.
     27 
     28   See `c:Ecto.Repo.rollback/1`.
     29   """
     30   @callback rollback(adapter_meta, value :: any) :: no_return
     31 end