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

Constructors for heterogeneous `Aerospike.batch_operate/3` requests.

Each constructor returns an opaque batch entry value. Pass a list of entries
to `Aerospike.batch_operate/3` to execute reads, writes, deletes, operations,
and record UDF calls in one batch request. Results are returned as
`%Aerospike.BatchResult{}` values in the same order as the input entries.

Parent batch policy is passed to `Aerospike.batch_operate/3`. Entry-level
read and write policy opts can be attached to each builder when a field is
encodable in the batch index protocol.

# `t`

```elixir
@type t() ::
  Aerospike.Batch.Read.t()
  | Aerospike.Batch.Put.t()
  | Aerospike.Batch.Delete.t()
  | Aerospike.Batch.Operate.t()
  | Aerospike.Batch.UDF.t()
```

One heterogeneous batch entry for `Aerospike.batch_operate/3`.

# `delete`

```elixir
@spec delete(Aerospike.Key.key_input(), Aerospike.batch_record_write_opts()) ::
  Aerospike.Batch.Delete.t()
```

Builds a delete entry.

# `key`

```elixir
@spec key(t()) :: Aerospike.Key.t()
```

Returns the key targeted by a batch entry.

# `operate`

```elixir
@spec operate(
  Aerospike.Key.key_input(),
  [Aerospike.Op.t()],
  Aerospike.batch_record_read_opts() | Aerospike.batch_record_write_opts()
) :: Aerospike.Batch.Operate.t()
```

Builds an operate entry from `Aerospike.Op` operations.

# `put`

```elixir
@spec put(
  Aerospike.Key.key_input(),
  Aerospike.Record.bins_input(),
  Aerospike.batch_record_write_opts()
) ::
  Aerospike.Batch.Put.t()
```

Builds a put entry from a non-empty bin map.

Bin names may be atoms or strings. Values follow the same supported value
subset as `Aerospike.put/4`.

# `read`

```elixir
@spec read(Aerospike.Key.key_input(), Aerospike.batch_record_read_opts()) ::
  Aerospike.Batch.Read.t()
```

Builds a full-record read entry.

Accepts `%Aerospike.Key{}` values or `{namespace, set, user_key}` tuples.

# `udf`

```elixir
@spec udf(
  Aerospike.Key.key_input(),
  String.t(),
  String.t(),
  list(),
  Aerospike.batch_record_write_opts()
) :: Aerospike.Batch.UDF.t()
```

Builds a record-UDF entry.

---

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