ash-queries
Building and executing queries with Ash.Query
- Category: discovered
- Tags: github, community
- Version: 1.0.0
- Author: walid
- Downloads: 0
- GitHub stars: 1
- Updated: 2025-11-21
Download the latest version (v1.0.0) from this page.
SKILL.md
--- name: ash-queries description: Building and executing queries with Ash.Query --- <!-- SPDX-FileCopyrightText: 2019 ash contributors <https://github.com/ash-project/ash/graphs.contributors> SPDX-License-Identifier: MIT --> # Querying Data Use `Ash.Query` to build queries for reading data from your resources. The query module provides a declarative way to filter, sort, and load data. ## Ash.Query.filter is a macro **Important**: You must `require Ash.Query` if you want to use `Ash.Query.filter/2`, as it is a macro. If you see errors like the following: ``` Ash.Query.filter(MyResource, id == ^id) error: misplaced operator ^id The pin operator ^ is supported only inside matches or inside custom macros... ``` ``` iex(3)> Ash.Query.filter(MyResource, something == true) error: undefined variable "something" └─ iex:3 ``` You are very likely missing a `require Ash.Query` ## Common Query Operations - **Filter**: `Ash.Query.filter(query, field == value)` - **Sort**: `Ash.Query.sort(query, field: :asc)` - **Load relationships**: `Ash.Query.load(query, [:author, :comments])` - **Limit**: `Ash.Query.limit(query, 10)` - **Offset**: `Ash.Query.offset(query, 20)`