Current section
Files
Jump to
Current section
Files
lib/ecto_interface/paginator/cursor.ex
defmodule EctoInterface.Paginator.Cursor do
@moduledoc false
def decode(nil), do: nil
def decode(encoded_cursor) do
encoded_cursor
|> Base.url_decode64!()
|> Plug.Crypto.non_executable_binary_to_term([:safe])
end
def encode(values) when is_map(values) do
values
|> :erlang.term_to_binary()
|> Base.url_encode64()
end
end