Dx.Scope (dx v0.3.5)
View SourceUsed as intermediate data structure to translating defd code to SQL.
Summary
Functions
Explicitly create an unfiltered scope for a schema module.
Looks up a scope using the provided Dx.Evaluation struct.
Runs any post-load processing defined in the scope.
Converts an atom to a scope using all/1 if given an atom, otherwise returns the input unchanged.
Looks up a scope if given {:ok, scope}, otherwise returns the input unchanged.
Looks up a scope if given one, otherwise wraps the input in an :ok tuple.
Types
@type t() :: %Dx.Scope{ aggregate?: boolean(), aggregate_default: term(), cardinality: :one | :many, main_condition_candidates: term(), opts: keyword(), plan: term(), post_load: {:loaded} | term(), ref: atom(), type: module() }
A scope struct used for translating defd code to SQL queries.
Fields:
:plan- The query plan to be executed:type- The schema module type:cardinality- Either:oneor:many(default::many):aggregate?- Whether this scope represents an aggregate query:aggregate_default- Default value to use for empty aggregates (e.g.0forcount):ref- Root alias when building the Ecto query (default::root):main_condition_candidates- Candidates for the main query condition:post_load- Post-processing defd functions to apply after loading (default:{:loaded}),e.g. filters that could not be translated to SQL:opts- Additional options (default:[])
Functions
Explicitly create an unfiltered scope for a schema module.
Looks up a scope using the provided Dx.Evaluation struct.
Runs any post-load processing defined in the scope.
Converts an atom to a scope using all/1 if given an atom, otherwise returns the input unchanged.
Looks up a scope if given {:ok, scope}, otherwise returns the input unchanged.
Looks up a scope if given one, otherwise wraps the input in an :ok tuple.