Reading in a loop
A query or Todo.get inside a for loop is a compile error, because it
would read once per item. Read the whole set with one query using in
instead:
// domains/planning/queries/todos_by_ids.jadpoquery todos_by_ids(todo_ids: List<Todo.id>) -> List<TodoView> { from: Todo where: Todo.id in todo_ids order: [Todo.created_at asc] limit: 100}
Writes inside a loop are allowed: the list is bounded, and every write joins the action's transaction.
An outside call inside a loop isn't allowed (Loops).
A loop of calls is batches.each
(How a run is kept). A batch
that should keep its partial progress is a schedule or subscriber
handling one item per action.
Markdown for agents: /docs/reading-in-a-loop.md.Built from Jadpo main at a707efb.