# `Arcadic.Record`
[🔗](https://github.com/baselabs/arcadic/blob/baselabs_arcadic-v4.0.1/lib/arcadic/record.ex#L5)

Creates, looks up, updates, and deletes records through ArcadeDB's gRPC
record API. Use an `@rid` to address an existing record. Lookups return
raw property maps. An HTTP or Bolt connection returns `:not_supported`.

    {:ok, rid} = Arcadic.Record.create(grpc_conn, "Person", %{"name" => "Ada"})
    {:ok, %{"name" => "Ada", "@rid" => ^rid}} = Arcadic.Record.lookup(grpc_conn, rid)
    :ok = Arcadic.Record.update(grpc_conn, rid, %{"age" => 36})
    :ok = Arcadic.Record.delete(grpc_conn, rid)

Values are encoded value-free (an unencodable value → `{:error, :invalid_record}`, no echo).
`update/4` merges properties by default (partial update); `replace: true` replaces the record.

# `create`

```elixir
@spec create(Arcadic.Conn.t(), String.t(), map(), keyword()) ::
  {:ok, String.t()} | {:error, atom() | Exception.t()}
```

Create a record of `type` from a property map. Returns `{:ok, rid}`.

# `delete`

```elixir
@spec delete(Arcadic.Conn.t(), String.t(), keyword()) ::
  :ok | {:error, atom() | Exception.t()}
```

Delete a record by `rid`. Returns `:ok`.

# `lookup`

```elixir
@spec lookup(Arcadic.Conn.t(), String.t(), keyword()) ::
  {:ok, map() | nil} | {:error, atom() | Exception.t()}
```

Look up a record by `rid`. Returns `{:ok, map}` (with `@rid`/`@type`), or `{:ok, nil}` if absent.

# `update`

```elixir
@spec update(Arcadic.Conn.t(), String.t(), map(), keyword()) ::
  :ok | {:error, atom() | Exception.t()}
```

Update a record by `rid`. Merges `props` (partial); `replace: true` replaces the record. Returns `:ok`.

---

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