Selecto.Subfilter.JoinPathResolver (Selecto v0.4.3)

Resolve relationship paths into join sequences using domain join-path configuration.

This module expects a domain configuration with a flat joins map keyed by relationship paths (e.g. "orders.customer.name").

Link to this section Summary

Functions

Resolve relationship path into join sequence using domain configuration.

Resolve multiple relationship paths at once for compound subfilters.

Validate that a relationship path can be resolved with the given domain configuration.

Link to this section Functions

Link to this function

resolve(path, domain_name, base_table \\ nil)

@spec resolve(Selecto.Subfilter.RelationshipPath.t(), atom() | map(), atom() | nil) ::
  {:ok, Selecto.Subfilter.JoinPathResolver.JoinResolution.t()}
  | {:error, Selecto.Subfilter.Error.t()}

Resolve relationship path into join sequence using domain configuration.

parameters

Parameters

  • relationship_path - Parsed RelationshipPath struct
  • domain_name - Domain identifier or a domain join-path config map
  • base_table - Base table for the query (defaults to first segment of path)

returns

Returns

| {:error, Subfilter.Error.t()}

Link to this function

resolve_multiple(paths, domain_name, base_table \\ nil)

@spec resolve_multiple(
  [Selecto.Subfilter.RelationshipPath.t()],
  atom() | map(),
  atom() | nil
) ::
  {:ok, [Selecto.Subfilter.JoinPathResolver.JoinResolution.t()]}
  | {:error, Selecto.Subfilter.Error.t()}

Resolve multiple relationship paths at once for compound subfilters.

This is more efficient than resolving paths individually when dealing with compound subfilters (AND/OR operations) as it can detect and reuse common join sequences.

Link to this function

validate_path(path, domain_name)

@spec validate_path(Selecto.Subfilter.RelationshipPath.t(), atom() | map()) ::
  :ok | {:error, Selecto.Subfilter.Error.t()}

Validate that a relationship path can be resolved with the given domain configuration.

This is useful for early validation before attempting to build queries.