View Source Quarto.Cursor behaviour (Quarto v1.1.7)
Behaviour for custom encoding of cursor values.
Used if you want finer control over how the values are encoded or decoded. Could be used to ensure the cursor are signed or validate cursors at your application boundaries.
defmodule CustomCursor do
@behaviour Quarto.Cursor
...
end
Quarto.Post
|> order_by(desc: :id)
|> Repo.paginate(cursor: CustomCursor)
Link to this section Summary
Callbacks
Decodes a cursor binary.
Decodes a cursor binary.
Encodes an erlang term
Encodes an erlang term.
Link to this section Callbacks
Specs
Decodes a cursor binary.
Returns an :ok tuple if it was able to decode the cursor, or else an :error tuple
Specs
Decodes a cursor binary.
Returns the cursor or raises when it fails to decode
Specs
Encodes an erlang term
Returns an :ok tuple if it was able to encode the cursor, or else an :error tuple
Specs
Encodes an erlang term.
Returns the cursor or raises when it fails to encodes