# `Aerospike.Op`
[🔗](https://github.com/luisgabrielroldan/aerospike_driver/blob/v0.3.1/lib/aerospike/op.ex#L1)

Primitive record operations for `Aerospike.operate/4`.

These builders create the simple bin operations used by the server's
operate command: write a bin, read a bin, read only record metadata,
increment a numeric bin, and append or prepend string data. Use the CDT
modules for collection bins and `Aerospike.Op.Exp` for expression-backed
operate calls.

    key = Aerospike.key("test", "users", "user:1")

    {:ok, record} =
      Aerospike.operate(cluster, key, [
        Aerospike.Op.add("login_count", 1),
        Aerospike.Op.put("last_seen", "2026-04-27"),
        Aerospike.Op.get("login_count")
      ])

Read operations return data in the `%Aerospike.Record{}` returned by
`Aerospike.operate/4`; write operations affect the record on the server and
only return data when the server operation itself produces a result.

See also `Aerospike.Op.Bit`, `Aerospike.Op.Exp`, `Aerospike.Op.HLL`,
`Aerospike.Op.List`, and `Aerospike.Op.Map` for collection and expression
operations.

# `bin_name`

```elixir
@type bin_name() :: String.t() | atom()
```

Bin name accepted by primitive operate builders.

Atom bin names are converted to strings before the operation is encoded.

# `t`

```elixir
@opaque t()
```

Opaque wire operation.

# `add`

```elixir
@spec add(bin_name(), integer() | float()) :: t()
```

Adds `delta` to a numeric bin.

The server creates the bin when needed and returns an error if the existing
value is not numeric.

# `append`

```elixir
@spec append(bin_name(), String.t()) :: t()
```

Appends `suffix` to a string bin.

# `get`

```elixir
@spec get(bin_name()) :: t()
```

Reads `bin_name` from the record.

The returned operation projects the requested bin into the operate response.

# `get_header`

```elixir
@spec get_header() :: t()
```

Reads only record metadata.

This operation asks the server for the record generation and TTL without
returning bin data.

# `prepend`

```elixir
@spec prepend(bin_name(), String.t()) :: t()
```

Prepends `prefix` to a string bin.

# `put`

```elixir
@spec put(bin_name(), term()) :: t()
```

Writes `value` to `bin_name`.

The value must be encodable by the Aerospike particle encoder. Atom bin names
are converted to strings.

---

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