Pleroma v1.1.9-10-g42f76306+dev Pleroma.User.Query View Source

User query builder module. Builds query from new query or another user query.

## Example:

  query = Pleroma.User.Query.build(%{nickname: "nickname"})
  another_query = Pleroma.User.Query.build(query, %{email: "email@example.com"})
  Pleroma.Repo.all(query)
  Pleroma.Repo.all(another_query)

Adding new rules:

  • ilike criteria

    • add field to @ilike_criteria list
    • pass non empty string
    • e.g. Pleroma.User.Query.build(%{nickname: "nickname"})
  • equal criteria

    • add field to @equal_criteria list
    • pass non empty string
    • e.g. Pleroma.User.Query.build(%{email: "email@example.com"})
  • contains criteria

    • add field to @containns_criteria list
    • pass values list
    • e.g. Pleroma.User.Query.build(%{ap_id: ["http://ap_id1", "http://ap_id2"]})

Link to this section Summary

Link to this section Types

Link to this type

criteria()

View Source
criteria() ::
  %{
    query: String.t(),
    tags: [String.t()],
    name: String.t(),
    email: String.t(),
    local: boolean(),
    external: boolean(),
    active: boolean(),
    deactivated: boolean(),
    is_admin: boolean(),
    is_moderator: boolean(),
    super_users: boolean(),
    followers: Pleroma.User.t(),
    friends: Pleroma.User.t(),
    recipients_from_activity: [String.t()],
    nickname: [String.t()],
    ap_id: [String.t()],
    order_by: term(),
    select: term(),
    limit: pos_integer()
  }
  | %{}

Link to this section Functions

Link to this function

build(query \\ base_query(), criteria)

View Source
Link to this function

paginate(query, page, page_size)

View Source