MishkaGervaz.Table.Web.DataLoader.QueryBuilder
(MishkaGervaz v0.0.1-alpha.2)
Copy Markdown
View Source
Builds Ash queries with filters and sorting from table state.
Overridable Functions
build_query/1- Build complete query from stateapply_filters_to_query/4- Apply filter values to query with state contextapply_sorting_to_query/2- Apply sort fields to queryapply_default_filter/3- Apply filter when no type_module is configuredbuild_apply_context/1- Build context map passed toapplyfunctions
User Override
defmodule MyApp.Table.DataLoader.QueryBuilder do
use MishkaGervaz.Table.Web.DataLoader.QueryBuilder
def apply_default_filter(query, field, value) when is_binary(value) do
Ash.Query.filter(query, ^ref(field) == ^value)
end
endSee MishkaGervaz.Table.Web.DataLoader,
MishkaGervaz.Table.Web.DataLoader.Helpers,
MishkaGervaz.Table.Types.Filter,
and the sibling sub-builders FilterParser, PaginationHandler,
TenantResolver, HookRunner, RelationLoader.