Skip to content

Provide function group descriptions in Ecto.Repo #4643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 28, 2025

Conversation

rhcarvalho
Copy link
Contributor

@rhcarvalho rhcarvalho commented Jul 28, 2025

  • Add descriptions to "Query API", "Schema API", etc.
  • Move Ecto.Repo.all_running/0 to "Process API" group.

I was reading the docs for update_all and was surprised to find it under "Query API", while other update-related callback functions are part of the "Schema API".

I understand "Query API" is for all APIs related to reading from the database, and "Schema API" for writing. In that interpretation, load, reload, reload!, and preload would also fit better within Query API.
Update: the groups are based on the data they operate on, see #4643 (comment).

The all_running/0 function was the only one outside any group, but it fits with the "Process API" group.

@josevalim
Copy link
Member

Query API receives an Ecto.Query, while the Schema API receives an schema. Perhaps we should make it clearer? New ExDoc versions allows us to add descriptions to each group, perhaps we should use that. And yes, Process API group is perfect.

@rhcarvalho
Copy link
Contributor Author

Query API receives an Ecto.Query, while the Schema API receives an schema.

Aha, I see, under this definition it makes sense that update_all and update are separate.

New ExDoc versions allows us to add descriptions to each group, perhaps we should use that.

I'll look into it.

@rhcarvalho
Copy link
Contributor Author

New ExDoc versions allows us to add descriptions to each group, perhaps we should use that.

I found how to do it in ex_doc main https://github.com/elixir-lang/ex_doc/blame/3ebc1daa20f8aa54f53e15f5da6d7c1559ec64ea/lib/mix/tasks/docs.ex#L368-L382, but it is not yet released.

Latest release: https://hexdocs.pm/ex_doc/0.38.2/Mix.Tasks.Docs.html#module-grouping-functions-types-and-callbacks

References:


Changes:

  • I've updated the patch to only move all_running/0 from no group to "Process API", reverting other changes/moves that do not make sense according to what each group was meant for.
  • Bumped ex_doc (picking up from main) to use @moduledoc groups: instead of groups_for_docs

Looks like this:

image

I wonder if we should hold off until a new release of ExDoc?

@rhcarvalho rhcarvalho changed the title Fix doc groups in Ecto.Repo Provide function group descriptions in Ecto.Repo Jul 28, 2025
@josevalim josevalim merged commit a37cafd into elixir-ecto:master Jul 28, 2025
7 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants