zf

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

structure.ex (1995B)


      1 defmodule Ecto.Adapter.Structure do
      2   @moduledoc """
      3   Specifies the adapter structure (dump/load) API.
      4   """
      5 
      6   @doc """
      7   Dumps the given structure.
      8 
      9   The path will be looked in the `config` under :dump_path or
     10   default to the structure path inside `default`.
     11 
     12   Returns `:ok` if it was dumped successfully, an error tuple otherwise.
     13 
     14   ## Examples
     15 
     16       structure_dump("priv/repo", username: "postgres",
     17                                   database: "ecto_test",
     18                                   hostname: "localhost")
     19 
     20   """
     21   @callback structure_dump(default :: String.t, config :: Keyword.t) ::
     22             {:ok, String.t} | {:error, term}
     23 
     24   @doc """
     25   Loads the given structure.
     26 
     27   The path will be looked in the `config` under :dump_path or
     28   default to the structure path inside `default`.
     29 
     30   Returns `:ok` if it was loaded successfully, an error tuple otherwise.
     31 
     32   ## Examples
     33 
     34       structure_load("priv/repo", username: "postgres",
     35                                   database: "ecto_test",
     36                                   hostname: "localhost")
     37 
     38   """
     39   @callback structure_load(default :: String.t, config :: Keyword.t) ::
     40             {:ok, String.t} | {:error, term}
     41 
     42   @doc """
     43   Runs the dump command for the given repo / config.
     44 
     45   Calling this function will setup authentication and run the dump cli
     46   command with your provided `args`.
     47 
     48   The options in `opts` are passed directly to `System.cmd/3`.
     49 
     50   Returns `{output, exit_status}` where `output` is a string of the stdout
     51   (as long as no option `into` is provided, see `System.cmd/3`) and `exit_status`
     52   is the exit status of the invoation. (`0` for success)
     53 
     54   ## Examples
     55 
     56       iex> dump_cmd(["--data-only", "--table", "table_name"], [stdout_to_stderr: true], Acme.Repo.config())
     57       "--\n-- PostgreSQL database dump\n--\n" <> _rest
     58 
     59   """
     60   @callback dump_cmd(args :: [String.t()], opts :: Keyword.t(), config :: Keyword.t()) ::
     61               {output :: Collectable.t(), exit_status :: non_neg_integer()}
     62 end