Skip to content

Feature Request: Add Support filters and search in count_ functions #49

@rafaelofreitas

Description

@rafaelofreitas

Change the count_my_schemas function, to receive search and filter parameters.

  def count_my_schemas(field \\ :id) do
    Repo.aggregate(MySchema, :count, field)
  end

Something like that:

 def count_my_schemas(params \\ %{}) do
   search = params[:search]
   search_fields = params[:search_fields] || []
   filters = params[:filters] || %{}

   MySchema
   |> Crudry.Query.search(search, search_fields)
   |> Crudry.Query.filter(filters)
   |> Repo.count()
 end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions