---
url: /api/kiln/interfaces/QueryView.md
---
[Kiln API](../../index.md) / [kiln](../index.md) / QueryView

# Interface: QueryView\<P>

The result of one named query inside `system({ a: [...], b: [...] }, fn)`.

## Extends

* `Iterable`<`Entity`>

## Type Parameters

| Type Parameter | Default type |
| ------ | ------ |
| `P` *extends* [`QueryList`](../type-aliases/QueryList.md) | [`QueryList`](../type-aliases/QueryList.md) |

## Properties

| Property | Modifier | Type | Description |
| ------ | ------ | ------ | ------ |
|  `length` | `readonly` | `number` | Number of matching entities this run. |
|  `entities` | `readonly` | readonly `Entity`\[] | The matching entities. Do not keep this array across runs. |

## Methods

### first()

```ts
first(): Entity | undefined;
```

First matching entity, or undefined.

#### Returns

`Entity` | `undefined`

***

### forEach()

```ts
forEach(fn): void;
```

Calls fn for every matching entity.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `fn` | (`entity`, `index`) => `void` |

#### Returns

`void`

***

### each()

```ts
each(fn): void;
```

Like the per-entity system form: rows honour Mut() and read-only access.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `fn` | (`row`, `entity`) => `void` |

#### Returns

`void`
