lksh2812
How to jump to specific page with absinthe relay pagination?
I have pagination on root object. As the data is huge, I want the users to have the ability to jump to any arbitrary page. For reference this is what my query looks like right now.
Most Liked
csadewa
also, another hack, current Absinthe.Relay.Connection actually using offset pagination internally rather than cursor (keyset) pagination, so if you are able to get offset data (which, again, is page_size * page_num), you could use Absinthe.Relay.Connection.offset_to_cursor to transform offset to cursor, like
offset = page * first - 1
after_cursor =
case offset do
-1 -> nil
_ -> Absinthe.Relay.Connection.offset_to_cursor(offset)
end
new_p_args =
p_args
|> Map.delete(:page)
|> Map.put(:after, after_cursor)
Warning though, this is implementation detail, it might break on newer release on Absinthe.Relay.Connection
1
Popular in Questions
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I would like to know what is the best IDE for elixir development?
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
Other popular topics
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
As a follow up to my earlier question:
I have the code compiling and running but not getting a successful login from the rest server. ...
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New








