# `Arex.Record`
[🔗](https://github.com/m/exarcade/blob/v0.1.0/lib/arex/record.ex#L1)

Document-style CRUD helpers with tenant and scope awareness.

`Arex.Record` is the main high-level API for working with ordinary ArcadeDB
records. It stamps boundaries on writes, filters reads by boundaries when
provided, and returns normalized errors for missing or ambiguous results.

Input maps may use atom or string keys for ordinary fields. The module keeps
common CRUD workflows, boundary enforcement, and RID-based operations out of
handwritten SQL so application code can stay focused on domain logic.

Reach for `Arex.Record` when you want:

- inserts and updates decided from record shape
- `where:`-based upserts
- boundary-aware reads and deletes
- batch persistence in one SQLScript transaction

This is the module that most application code should start with before
dropping to raw `Arex.Query` or `Arex.Command`.

# `category`

Extracts `@cat` from a record map.

# `fetch`

Fetches a record by RID and enforces the active tenant and scope boundary.

# `fetch_multi`

Fetches many records by RID, returning `nil` for missing or out-of-boundary rows.

This keeps the returned list aligned with the input RID order.

# `get`

Finds records by filters and the required `type` option.

Active `tenant` and `scope` values are appended automatically to the filter
predicate when present.

# `get_one`

Returns one matching record or `nil`, failing on ambiguous matches.

# `get_property`

Fetches one property from a record identified by RID.

# `is_there?`

Returns whether at least one record matches the provided filters.

This is a convenience wrapper over `get/2` with `limit: 1`.

# `merge`

Merges attributes into an existing record and re-fetches the result.

# `persist`

Inserts a new record or updates an existing one.

Records without `@rid` are inserted. Records with `@rid` are updated by RID.

# `persist_multi`

Persists many records in a single SQLScript transaction.

The batch succeeds or fails atomically. Records with `@rid` are updated and
records without `@rid` are inserted.

# `persist_new`

Inserts a copy of a record while ignoring any existing `@rid`.

# `pop`

Removes a value from a list property when present.

# `push`

Appends a value to a list property when it is not already present.

# `replace`

Replaces a record's content while preserving its current boundary fields.

# `rid`

Extracts `@rid` from a record map.

# `switch_off`

Sets a boolean property to `false`.

# `switch_on`

Sets a boolean property to `true`.

# `type`

Extracts `@type` from a record map.

# `update_property`

Updates one mutable property and re-fetches the record.

# `upsert`

Upserts one record by type and `where:` filter.

The `where:` clause must be non-empty, and the operation fails when more than
one row matches. Boundary fields from `opts` remain authoritative and are
stamped onto the stored record.

# `vaporize`

Deletes a record map that contains `@rid`.

# `vaporize_by_id`

Deletes a record by RID.

---

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