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

Fix example showing of joined fields passed into fetch_cursor_value_fun #123

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

nickdichev
Copy link
Contributor

The fetch_cursor_value function only passes cursor_field to the fetch_cursor_value_fun:

  defp fetch_cursor_value(schema, %Config{
         cursor_fields: cursor_fields,
         fetch_cursor_value_fun: fetch_cursor_value_fun
       }) do
    cursor_fields
    |> Enum.map(fn
      {cursor_field, _order} ->
        {cursor_field, fetch_cursor_value_fun.(schema, cursor_field)}

      cursor_field when is_atom(cursor_field) ->
        {cursor_field, fetch_cursor_value_fun.(schema, cursor_field)}
    end)
    |> Map.new()
    |> Cursor.encode()
  end

The documentation example is incorrect because it shows the entire {cursor_field, direction} tuple is passed as the second parameter.

@sgerrand sgerrand self-assigned this Jun 9, 2021
Copy link
Contributor

@sgerrand sgerrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nickdichev for your contribution. Well spotted. LGTM. 👍

@sgerrand sgerrand force-pushed the fix_nested_cursor_field_example branch from 65e8bde to 128d28b Compare October 26, 2021 09:47
@sgerrand sgerrand merged commit f3cb4cd into duffelhq:main Oct 26, 2021
@sgerrand sgerrand removed their assignment Oct 26, 2021
@nickdichev nickdichev deleted the fix_nested_cursor_field_example branch October 26, 2021 16:39
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