aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/pagination.ex
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-03-02 07:58:01 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-03-02 07:58:01 +0000
commit764a50f8a671cca69ca1f616754660506f8c18d8 (patch)
tree998fea663c91daf6515c879079a3c0a9fa0f5ad5 /lib/pleroma/pagination.ex
parent6ceef768cba23ab79a5545330746c7d8ce97ed64 (diff)
parent34f1d09f3abffd97672832382e48bb8d7f178e90 (diff)
downloadpleroma-764a50f8a671cca69ca1f616754660506f8c18d8.tar.gz
Merge branch 'feature/1482-activity_pub_transactions' into 'develop'
ActivityPub actions & side-effects in transaction Closes #1482 See merge request pleroma/pleroma!2089
Diffstat (limited to 'lib/pleroma/pagination.ex')
-rw-r--r--lib/pleroma/pagination.ex4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex
index 1cd8c4462..d43a96cd2 100644
--- a/lib/pleroma/pagination.ex
+++ b/lib/pleroma/pagination.ex
@@ -12,12 +12,15 @@ defmodule Pleroma.Pagination do
alias Pleroma.Repo
+ @type type :: :keyset | :offset
+
@default_limit 20
@max_limit 40
@page_keys ["max_id", "min_id", "limit", "since_id", "order"]
def page_keys, do: @page_keys
+ @spec fetch_paginated(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()]
def fetch_paginated(query, params, type \\ :keyset, table_binding \\ nil)
def fetch_paginated(query, %{"total" => true} = params, :keyset, table_binding) do
@@ -58,6 +61,7 @@ defmodule Pleroma.Pagination do
|> Repo.all()
end
+ @spec paginate(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()]
def paginate(query, options, method \\ :keyset, table_binding \\ nil)
def paginate(query, options, :keyset, table_binding) do