Ash.Api.read

You're seeing just the callback read, go back to Ash.Api module for more information.

Specs

read(Ash.Query.t(), params :: Keyword.t()) ::
  {:ok, [Ash.Resource.record()]}
  | {:ok, [Ash.Resource.record()], Ash.Query.t()}
  | {:error, term()}

Run a query on a resource.

For more information, on building a query, see Ash.Query.

  • :page - Nested pagination options, see the section on pagination for more

  • :return_query? - If true, the query that was ultimately used is returned as a third tuple element.
    The query goes through many potential changes during a request, potentially adding authorization filters, or replacing relationships for other data layers with their corresponding ids. This option can be used to get the true query that was sent to the data layer. The default value is false.

  • :verbose? - Log engine operations (very verbose!) The default value is false.

  • :action - The action to use, either an Action struct or the name of the action

  • :authorize? - If an actor option is provided (even if it is nil), authorization happens automatically. If not, this flag can be used to authorize with no user.

  • :stacktraces? - For Ash errors, wether or not each error has a stacktrace. See the error_handling guide for more. The default value is true.

  • :tenant - A tenant to set on the query or changeset

  • :actor - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

Pagination

Limit/offset pagination

  • :offset - The number of records to skip from the beginning of the query

  • :limit - The number of records to include in the page

  • :filter - A filter to apply for pagination purposes, that should not be considered in the full count.
    This is used by the liveview paginator to only fetch the records that were already on the page when refreshing data, to avoid pages jittering.

  • :count - Whether or not to return the page with a full count of all records

Keyset pagination

  • :before - Get records that appear before the provided keyset (mutually exclusive with after)

  • :after - Get records that appear after the provided keyset (mutually exclusive with before)

  • :limit - How many records to include in the page

  • :filter - See the filter option for offset pagination, this behaves the same.

  • :count - Whether or not to return the page with a full count of all records