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

Dataloader.KV: load new items when results are non-empty #75

Merged
merged 4 commits into from
Apr 16, 2019

Commits on Apr 12, 2019

  1. Configuration menu
    Copy the full SHA
    e9e8e8d View commit details
    Browse the repository at this point in the history
  2. Demonstrate Dataloader.KV not making subsequent loads

    Add a Dataloader.KV test to assert that the loader can
    load new data in subsequent rounds.
    
    See issue absinthe-graphql#74
    alex-knowles committed Apr 12, 2019
    Configuration menu
    Copy the full SHA
    ef5c978 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2019

  1. Fixes issue absinthe-graphql#74

    Handle case where Dataloader.KV has some results and is asked
    to load an id that is neither present in 'results' or 'batches'.
    
    In this case Map.get/2 would return `nil`, which was falling
    through and being treated as if the id was found in the results.
    
    This replaces Map.get/2 with Map.get/3 so that we can provide
    an explicit value to pattern-match on (:error).
    alex-knowles committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    786abd0 View commit details
    Browse the repository at this point in the history
  2. Refactor Map.get/3 into Map.fetch/2

    Calling Map.get/3 with :error as the third argument is
    almost the same as calling Map.fetch/2 except that non-errors
    are wrapped in :ok tuples.
    
    This more clearly delinates the cases where a result is found
    and the case where a result is not found.  It also shows that
    {:error, reason} is expected to be mapped to 'id' in some
    situations.
    alex-knowles committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    0ccd519 View commit details
    Browse the repository at this point in the history