Skip to content
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

refactor: unify preload_defaults functions #316

Closed

Commits on Jul 11, 2023

  1. refactor: add fetch functions to Repo module

    they work like get functions but always return a tuple {:ok, item} or
    {:error, :not_found}
    
    Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
    noaccOS committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    6bb87c0 View commit details
    Browse the repository at this point in the history
  2. refactor: unify preload_defaults functions

    Provide a global `Repo.preload_defaults` to load default preloads for a
    given module, instead of using a distinct function for each one.
    
    `Repo.preload_defaults`'s logic is to make modules define their own
    `default_preloads/0` function, and use its return value as
    `Repo.preload/3`'s second parameter.
    
    `Repo.preload_defaults_in_result` is provided for ease of use after
    a fetch/update/insert method.
    
    Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
    noaccOS committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    c4c107b View commit details
    Browse the repository at this point in the history