FatEcto.Query.Dynamics.Helper (FatEcto v1.2.0)

View Source

Provides helper functions for Dynamics.

Summary

Functions

Merges two dynamic expressions using the specified operator. If either dynamic is nil, it returns the other dynamic. If both are nil, it returns nil. The operator can be :and or :or.

Functions

merge_dynamics(dynamic1, dynamic2, operator \\ :and)

@spec merge_dynamics(
  Ecto.Query.dynamic_expr() | nil,
  Ecto.Query.dynamic_expr() | nil,
  atom()
) ::
  Ecto.Query.dynamic_expr() | nil

Merges two dynamic expressions using the specified operator. If either dynamic is nil, it returns the other dynamic. If both are nil, it returns nil. The operator can be :and or :or.