storage.ex (1425B)
1 defmodule Ecto.Adapter.Storage do 2 @moduledoc """ 3 Specifies the adapter storage API. 4 """ 5 6 @doc """ 7 Creates the storage given by options. 8 9 Returns `:ok` if it was created successfully. 10 11 Returns `{:error, :already_up}` if the storage has already been created or 12 `{:error, term}` in case anything else goes wrong. 13 14 ## Examples 15 16 storage_up(username: "postgres", 17 database: "ecto_test", 18 hostname: "localhost") 19 20 """ 21 @callback storage_up(options :: Keyword.t) :: :ok | {:error, :already_up} | {:error, term} 22 23 @doc """ 24 Drops the storage given by options. 25 26 Returns `:ok` if it was dropped successfully. 27 28 Returns `{:error, :already_down}` if the storage has already been dropped or 29 `{:error, term}` in case anything else goes wrong. 30 31 ## Examples 32 33 storage_down(username: "postgres", 34 database: "ecto_test", 35 hostname: "localhost") 36 37 """ 38 @callback storage_down(options :: Keyword.t) :: :ok | {:error, :already_down} | {:error, term} 39 40 @doc """ 41 Returns the status of a storage given by options. 42 43 Can return `:up`, `:down` or `{:error, term}` in case anything goes wrong. 44 45 ## Examples 46 47 storage_status(username: "postgres", 48 database: "ecto_test", 49 hostname: "localhost") 50 51 """ 52 @callback storage_status(options :: Keyword.t()) :: :up | :down | {:error, term()} 53 end