Refine.FacetsTable (Refine v0.1.1)

Copy Markdown

Facets table functions.

Summary

Types

create_facets_table_return()

@type create_facets_table_return() ::
  {:ok, String.t()}
  | {:error, :column_not_found, String.t()}
  | {:error, :column_names_not_unique}
  | {:error, :facets_table_exists, String.t()}
  | {:error, :identity_column_already_exists, String.t()}
  | {:error, :identity_column_invalid_type, String.t()}
  | {:error, :identity_column_not_found, String.t()}
  | {:error, :invalid_table_name, String.t()}
  | {:error, :table_names_not_unique}
  | {:error, Exception.t()}

database_option()

@type database_option() :: {:repo, repo()} | postgrex_option()

facet_config()

@type facet_config() :: %{
  facet_name: String.t(),
  facet_label: String.t() | nil,
  value_column: String.t() | nil,
  label_column: String.t() | nil,
  value_path: String.t() | nil,
  label_path: String.t() | nil,
  width_bucket: [integer() | float()] | nil
}

facets_config()

@type facets_config() :: [facet_config()]

facets_table_config()

@type facets_table_config() :: %{
  facets_table: String.t(),
  source_table: String.t(),
  add_identity_column_if_not_exists: boolean() | nil,
  identity_column: String.t(),
  facets: facets_config(),
  roaringbitmap_type: String.t() | nil
}

postgrex_option()

@type postgrex_option() :: {:timeout, integer() | :infinity} | {:log, boolean()}

repo()

@type repo() :: module()

Functions

create_facets_table(config, opts \\ [])

@spec create_facets_table(facets_table_config(), [database_option()]) ::
  create_facets_table_return()

See: Refine.create_facets_table/2.

create_facets_table_if_not_exists(config, opts \\ [])

@spec create_facets_table_if_not_exists(
  facets_table_config(),
  [database_option()]
) :: create_facets_table_return()

See: Refine.create_facets_table_if_not_exists/2.

drop_facets_table(config, opts \\ [])

@spec drop_facets_table(facets_table_config(), [database_option()]) ::
  {:ok, String.t()} | {:error, :table_not_found} | {:error, Exception.t()}

See: Refine.drop_facets_table/2.

table_names_unique?(qualified_table_name_a, qualified_table_name_b)

@spec table_names_unique?(String.t(), String.t()) ::
  :ok | {:error, :table_names_not_unique}