Selecto.Types (Selecto v0.3.8)
Comprehensive type definitions for the Selecto query builder.
This module defines all the types used throughout Selecto for better developer experience and Dialyzer support.
Link to this section Summary
Link to this section Types
Link to this type
advanced_join_type()
@type advanced_join_type() ::
:hierarchical | :tagging | :dimension | :star_dimension | :snowflake_dimension
Link to this type
association()
Link to this type
atom_or_string()
Link to this type
basic_filter()
@type basic_filter() :: {field_name(), term()}
Link to this type
basic_join_config()
@type basic_join_config() :: %{ :type => basic_join_type(), optional(:name) => String.t(), optional(:on) => term(), optional(:joins) => %{required(atom()) => join_config()} }
Link to this type
basic_join_type()
@type basic_join_type() :: :left | :right | :inner | :full
Link to this type
basic_selector()
@type basic_selector() :: field_name()
Link to this type
builder_result()
@type builder_result() :: {iodata_with_markers(), sql_params(), join_dependencies()}
Link to this type
case_selector()
Link to this type
column_definition()
@type column_definition() :: %{ :type => column_type(), optional(:precision) => pos_integer(), optional(:scale) => non_neg_integer(), optional(:default) => term(), optional(:null) => boolean() }
Link to this type
column_type()
@type column_type() ::
:integer
| :string
| :text
| :boolean
| :decimal
| :float
| :date
| :time
| :utc_datetime
| :naive_datetime
| :binary
| :uuid
| :json
| :jsonb
| :array
| :geometry
| :geography
| :point
| :linestring
| :polygon
| :multipoint
| :multilinestring
| :multipolygon
| :geometrycollection
Link to this type
comparison_filter()
@type comparison_filter() :: {field_name(), {comparison_operator(), term()}}
Link to this type
comparison_operator()
@type comparison_operator() ::
:eq
| :not_eq
| :gt
| :gte
| :lt
| :lte
| :like
| :ilike
| :not_like
| :not_ilike
| :is_null
| :not_null
| :in
| :not_in
| :between
| :not_between
Link to this type
configure_options()
@type configure_options() :: [{:validate, boolean()}]
Link to this type
cte_builder_result()
@type cte_builder_result() :: {iodata_with_markers(), sql_params(), [cte_definition()]}
Link to this type
cte_definition()
@type cte_definition() :: %{ name: String.t(), sql: iodata_with_markers(), params: sql_params(), recursive: boolean() }
Link to this type
cte_marker()
@type cte_marker() :: {:cte, name :: String.t(), iodata_fragment()}
Link to this type
custom_selector()
Link to this type
dimension_join_config()
@type dimension_join_config() :: %{ :type => :dimension | :star_dimension | :snowflake_dimension, :display_field => atom(), optional(:dimension_key) => atom(), optional(:normalization_joins) => [ %{table: String.t(), key: atom(), foreign_key: atom()} ], optional(:joins) => %{required(atom()) => join_config()} }
Link to this type
domain()
@type domain() :: %{ :name => String.t(), :source => source(), :schemas => %{required(atom()) => schema()}, :joins => %{required(atom()) => join_config()}, optional(:default_selected) => [selector()], optional(:required_filters) => [filter()], optional(:required_selected) => [selector()], optional(:required_order_by) => [order_spec()], optional(:required_group_by) => [field_name()], optional(:filters) => %{required(String.t()) => term()}, optional(:domain_data) => term(), optional(:extensions) => [term()] }
Link to this type
domain_option_provider()
@type domain_option_provider() :: %{ type: :domain, domain: atom(), value_field: atom(), display_field: atom(), filters: [filter()], order_by: [order_spec()] }
Link to this type
enum_option_provider()
Link to this type
execute_one_result_error()
@type execute_one_result_error() :: {:error, Selecto.Error.t()}
Link to this type
execute_one_result_ok()
@type execute_one_result_ok() :: {:ok, single_row_result()}
Link to this type
execute_options()
Link to this type
execute_result_error()
@type execute_result_error() :: {:error, Selecto.Error.t()}
Link to this type
execute_result_ok()
@type execute_result_ok() :: {:ok, query_result()}
Link to this type
execute_stream_result_error()
@type execute_stream_result_error() :: {:error, Selecto.Error.t()}
Link to this type
execute_stream_result_ok()
@type execute_stream_result_ok() :: {:ok, Enumerable.t()}
Link to this type
extract_selector()
@type extract_selector() :: {:extract, part :: String.t(), from_field :: field_name()}
Link to this type
field_name()
Link to this type
filter()
@type filter() :: basic_filter() | comparison_filter() | logical_filter()
Link to this type
function_selector()
@type function_selector() :: {:func, function_name :: String.t(), args :: [field_name() | term()]}
Link to this type
hierarchical_join_config()
@type hierarchical_join_config() :: %{ :type => :hierarchical, :hierarchy_type => hierarchy_type(), optional(:depth_limit) => pos_integer(), optional(:path_field) => atom(), optional(:path_separator) => String.t(), optional(:root_condition) => term(), optional(:joins) => %{required(atom()) => join_config()} }
Link to this type
hierarchy_type()
@type hierarchy_type() :: :adjacency_list | :materialized_path | :closure_table
Link to this type
iodata_fragment()
Link to this type
iodata_with_markers()
@type iodata_with_markers() :: [iodata_fragment() | param_marker() | cte_marker()]
Link to this type
join_config()
@type join_config() :: basic_join_config() | hierarchical_join_config() | tagging_join_config() | dimension_join_config()
Link to this type
join_dependencies()
@type join_dependencies() :: [join_requirement()]
Link to this type
join_requirement()
Link to this type
join_type()
@type join_type() :: basic_join_type() | advanced_join_type()
Link to this type
logical_filter()
@type logical_filter() :: {:and | :or, [filter()]}
Link to this type
maybe(t)
@type maybe(t) :: {:ok, t} | {:error, term()}
Link to this type
option_provider()
@type option_provider() :: static_option_provider() | domain_option_provider() | enum_option_provider() | query_option_provider()
Link to this type
order_direction()
@type order_direction() :: :asc | :desc
Link to this type
order_spec()
@type order_spec() :: field_name() | {order_direction(), field_name()}
Link to this type
param_marker()
@type param_marker() :: {:param, term()}
Link to this type
pivot_config()
Link to this type
pivot_join_path()
Link to this type
processed_config()
@type processed_config() :: %{ :source => source(), :source_table => table_name(), :primary_key => atom(), :columns => %{required(String.t()) => %{name: String.t()}}, :joins => %{required(atom()) => processed_join()}, :filters => %{required(String.t()) => term()}, :domain_data => term(), optional(:extensions) => [{module(), keyword()}] }
Link to this type
processed_join()
@type processed_join() :: %{ :type => join_type(), :source => atom() | String.t(), :name => String.t(), optional(:fields) => %{required(String.t()) => %{name: String.t()}}, optional(:filters) => %{required(String.t()) => term()}, optional(:joins) => %{required(atom()) => processed_join()}, optional(:parameters) => [term()], optional(:hierarchy_type) => hierarchy_type(), optional(:depth_limit) => pos_integer(), optional(:path_field) => atom(), optional(:path_separator) => String.t(), optional(:tag_field) => atom(), optional(:weight_field) => atom(), optional(:display_field) => atom(), optional(:dimension_key) => atom() }
Link to this type
query_option_provider()
Link to this type
query_result()
Link to this type
query_set()
@type query_set() :: %{ :selected => [selector()], :filtered => [filter()], optional(:required_filters) => [filter()], optional(:post_pivot_filters) => [filter()], :order_by => [order_spec()], :group_by => [field_name()], optional(:pivot_state) => pivot_config(), optional(:subselected) => [subselect_selector()] }
Link to this type
result(t, e)
@type result(t, e) :: {:ok, t} | {:error, e}
Link to this type
safe_execute_one_result()
@type safe_execute_one_result() :: execute_one_result_ok() | execute_one_result_error()
Link to this type
safe_execute_result()
@type safe_execute_result() :: execute_result_ok() | execute_result_error()
Link to this type
safe_execute_stream_result()
@type safe_execute_stream_result() :: execute_stream_result_ok() | execute_stream_result_error()
Link to this type
schema()
@type schema() :: %{ :name => String.t(), :source_table => table_name(), :primary_key => atom(), :fields => [atom()], :redact_fields => [atom()], :columns => %{required(atom()) => column_definition()}, :associations => %{required(atom()) => association()}, optional(:custom_filters) => %{required(atom()) => term()} }
Link to this type
select_options_column()
@type select_options_column() :: %{ :type => :select_options, :option_provider => option_provider(), :name => String.t(), optional(:multiple) => boolean(), optional(:searchable) => boolean(), optional(:cache_ttl) => pos_integer() }
Link to this type
selector()
@type selector() :: basic_selector() | function_selector() | case_selector() | extract_selector() | window_selector() | custom_selector()
Link to this type
single_row_result()
Link to this type
source()
@type source() :: %{ source_table: table_name(), primary_key: atom(), fields: [atom()], redact_fields: [atom()], columns: %{required(atom()) => column_definition()}, associations: %{required(atom()) => association()} }
Link to this type
sql_error()
@type sql_error() :: Postgrex.Error.t()
Link to this type
sql_generation_options()
Link to this type
sql_params()
@type sql_params() :: [term()]
Link to this type
sql_result()
@type sql_result() :: {sql :: String.t(), params :: sql_params()}
Link to this type
static_option_provider()
@type static_option_provider() :: %{type: :static, values: [term()]}
Link to this type
stream_row_result()
Link to this type
subselect_config()
@type subselect_config() :: %{ :target_table => table_name(), :join_condition => {field_name(), field_name()}, :aggregation_type => subselect_format(), optional(:additional_filters) => [filter()] }
Link to this type
subselect_format()
@type subselect_format() :: :json_agg | :array_agg | :string_agg | :count
Link to this type
subselect_selector()
@type subselect_selector() :: %{ :fields => [field_name()], :target_schema => atom(), :format => subselect_format(), optional(:alias) => String.t(), optional(:separator) => String.t(), optional(:order_by) => [order_spec()], optional(:filters) => [filter()] }
@type t() :: %Selecto{ adapter: module() | nil, config: processed_config(), connection: term() | nil, domain: domain(), extensions: [{module(), keyword()}], postgrex_opts: Postgrex.conn() | nil, set: query_set(), tenant: tenant_context() | nil }
Link to this type
table_name()
@type table_name() :: String.t()
Link to this type
tagging_join_config()
@type tagging_join_config() :: %{ :type => :tagging, :tag_field => atom(), optional(:weight_field) => atom(), optional(:min_weight) => number(), optional(:aggregation) => :string_agg | :array_agg | :count, optional(:separator) => String.t(), optional(:joins) => %{required(atom()) => join_config()} }
Link to this type
tenant_context()
Link to this type