Skip to content

Instantly share code, notes, and snippets.

View edipox's full-sized avatar
:shipit:
Working from home

Edipo Vinicius da Silva edipox

:shipit:
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am edipox on github.
  • I am edipox (https://keybase.io/edipox) on keybase.
  • I have a public key ASCqumcwrUEQriME6rhcN02nkpdaDNsdOzD7kM7zA2uF-wo

To claim this, I am signing this object:

@edipox
edipox / jsonapi_paginator.ex
Last active May 16, 2022 17:24
elixir scrivener handle slow couting example
# Paginate
@spec handle_pagination(conn :: Plug.Conn.t(), page :: number | atom, page_size :: number | atom, query :: module) ::
Plug.Conn.t()
defp handle_pagination(conn, page, page_size, query) do
config = %Scrivener.Config{
module: Repo,
page_number: page,
page_size: page_size,
options: [total_entries: total_entries(query)]
}