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

cursor fields can't find field inside select ordered by fragment #194

Open
allanegidio opened this issue Feb 6, 2024 · 0 comments
Open

Comments

@allanegidio
Copy link

allanegidio commented Feb 6, 2024

Hey guys.

I've been having some issues executing queries with select bidings and ordering by these bidings using fragments.
If I have some query that is using :select bidings for example and ordered by it using fragment:

from(
  u in User,
  join: c in Contact,
  on: c.user_id = u.id,
  order_by: fragment("new_field")
  select: %{
    new_field: c.some_field
  }
)

My cursor fields can't find my new_field on my query during pagination but none option worked:

[cursor_fields: [{:new_field, :desc}], limit: 10]
[cursor_fields: [{"new_field", :desc}], limit: 10]

I also tried using but not had success

fetch_cursor_value_fun: fn
        schema, :new_field ->
          schema.new_field
          
        schema, field ->
          Paginator.default_fetch_cursor_value(schema, field)
      end,

I'm doing some mistake or it is just not possible to do it?

@allanegidio allanegidio changed the title cursor fields doesn't find field inside select. cursor fields can't find field inside select ordered by fragment Feb 6, 2024
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

No branches or pull requests

1 participant