OuterfacesEctoApi.QueryEngine (Outerfaces Ecto API v0.2.8)

View Source

Summary

Types

all_response()

@type all_response() :: {:ok, paginated_success()} | {:error, error_response()}

error_response()

@type error_response() :: %{
  :status => pos_integer(),
  :results => %{
    :data => nil,
    :schema => String.t(),
    optional(:page_info) => pagination_info() | nil,
    optional(:id) => integer()
  },
  optional(:debug) => map()
}

filter_spec()

get_response()

@type get_response() :: {:ok, single_success()} | {:error, error_response()}

paginated_success()

@type paginated_success() :: %{
  status: pos_integer(),
  results: %{data: [map()], page_info: pagination_info(), schema: String.t()}
}

pagination_info()

params()

@type params() :: map()

preload()

@type preload() :: atom() | {atom(), [preload()]}

repo()

@type repo() :: Ecto.Repo.t()

schema()

@type schema() :: module()

single_success()

@type single_success() :: %{
  status: pos_integer(),
  results: %{data: map(), schema: String.t(), id: integer()}
}

sort_spec()

Functions

all(repo, schema, preloads, filter_specs, sort_specs, params, opts \\ [])

@spec all(
  repo(),
  schema(),
  [preload()],
  [filter_spec()],
  [sort_spec()],
  params(),
  Keyword.t()
) ::
  all_response()

build(schema, filters, params, opts \\ [])

@spec build(
  schema(),
  [filter_spec()],
  params(),
  Keyword.t()
) :: {:ok, Ecto.Query.t()} | {:error, atom()}

get(repo, schema, id, preloads \\ [], opts \\ [])

@spec get(repo(), schema(), [preload()], binary() | integer(), Keyword.t()) ::
  get_response()