# `MishkaInstaller.Helper.MnesiaAssistant.Query`
[🔗](https://github.com/mishka-group/mishka_installer/blob/v0.1.16/lib/helper/mnesia_assistant/query.ex#L1)

Record-level Mnesia operations (read / write / delete / select / match).

Every function must run inside a `MishkaInstaller.Helper.MnesiaAssistant.Transaction` activity;
the `dirty_*` reads run in `MishkaInstaller.Helper.MnesiaAssistant.Transaction.dirty/1`.

# `delete`

```elixir
@spec delete(atom(), term(), :write | :sticky_write) :: :ok
```

Deletes the record at `key` in `table` with the given lock. Delegates to `:mnesia.delete/3`.

# `dirty_index_read`

```elixir
@spec dirty_index_read(atom(), term(), atom()) :: [tuple()]
```

Reads the records whose indexed `attr` is `key` without a lock. Delegates to
`:mnesia.dirty_index_read/3`.

# `dirty_match_object`

```elixir
@spec dirty_match_object(tuple()) :: [tuple()]
```

Returns every record in a table matching `pattern` without a lock. Delegates to
`:mnesia.dirty_match_object/1`.

# `dirty_read`

```elixir
@spec dirty_read(atom(), term()) :: [tuple()]
```

Reads the records stored under `key` in `table` without a lock. Delegates to
`:mnesia.dirty_read/2`.

# `dirty_select`

```elixir
@spec dirty_select(atom(), list()) :: list()
```

Runs a match specification against `table` without a lock. Delegates to
`:mnesia.dirty_select/2`.

# `index_read`

```elixir
@spec index_read(atom(), term(), atom()) :: [tuple()]
```

Reads records via a secondary index `attr` matching `key`. Delegates to `:mnesia.index_read/3`.

# `match_object`

```elixir
@spec match_object(tuple()) :: [tuple()]
```

Returns every record in a table matching `pattern`. Delegates to `:mnesia.match_object/1`.

# `read`

```elixir
@spec read(atom(), term()) :: [tuple()]
```

Reads the records stored under `key` in `table`. Delegates to `:mnesia.read/2`.

# `select`

```elixir
@spec select(atom(), list()) :: list()
```

Runs a match specification against `table`. Delegates to `:mnesia.select/2`.

# `write`

```elixir
@spec write(tuple()) :: :ok
```

Writes a full record tuple (`{Table, field1, field2, ...}`). Delegates to `:mnesia.write/1`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
