# `Aerospike.Exp.List`
[🔗](https://github.com/luisgabrielroldan/aerospike_driver/blob/v0.3.1/lib/aerospike/exp/list.ex#L1)

List CDT expression helpers.

These builders create expressions that evaluate list operations against a
list expression, usually `Aerospike.Exp.list_bin/1`.

# `opts`

```elixir
@type opts() :: [policy: policy(), return_type: return_type()]
```

Common list expression options.

Supported keys:

* `:policy` - list write policy for modify expressions that document it.
* `:return_type` - selector return type such as `:value`, `:count`, or
  `[:value, :inverted]`.

# `policy`

```elixir
@type policy() :: Aerospike.Op.List.policy()
```

List expression write policy accepted in `opts[:policy]`.

Append/increment operations expect both `:order` and `:flags`; insert and set
operations encode only `:flags`.

# `return_type`

```elixir
@type return_type() :: Aerospike.Op.List.return_type()
```

List selector return type.

# `t`

```elixir
@type t() :: Aerospike.Exp.t()
```

Opaque server-side expression.

# `append`

```elixir
@spec append(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Appends `value` to a list expression. Supports `policy:`.

# `append_items`

```elixir
@spec append_items(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Appends list expression `values` to a list expression. Supports `policy:`.

# `clear`

```elixir
@spec clear(Aerospike.Exp.t()) :: t()
```

Removes all values from the list expression.

# `get_by_index`

```elixir
@spec get_by_index(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.exp_type(),
  opts()
) :: t()
```

Returns the value at `index`, selected by `return_type:`.

# `get_by_index_range`

```elixir
@spec get_by_index_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Returns `count` values from `index`, selected by `return_type:`.

# `get_by_index_range_from`

```elixir
@spec get_by_index_range_from(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Returns values from `index` through the end, selected by `return_type:`.

# `get_by_rank`

```elixir
@spec get_by_rank(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.exp_type(),
  opts()
) :: t()
```

Returns the value at `rank`, selected by `return_type:`.

# `get_by_rank_range`

```elixir
@spec get_by_rank_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Returns `count` values from `rank`, selected by `return_type:`.

# `get_by_rank_range_from`

```elixir
@spec get_by_rank_range_from(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Returns values from `rank` through the highest rank, selected by `return_type:`.

# `get_by_value`

```elixir
@spec get_by_value(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Returns values equal to `value`, selected by `return_type:`.

# `get_by_value_list`

```elixir
@spec get_by_value_list(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Returns values matching any expression in `values`, selected by `return_type:`.

# `get_by_value_range`

```elixir
@spec get_by_value_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t() | nil,
  Aerospike.Exp.t() | nil,
  opts()
) ::
  t()
```

Returns values in `[begin_value, end_value)`, selected by `return_type:`.

# `get_by_value_rel_rank_range`

```elixir
@spec get_by_value_rel_rank_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) ::
  t()
```

Returns values nearest to `value` and greater by relative `rank`.

# `get_by_value_rel_rank_range_count`

```elixir
@spec get_by_value_rel_rank_range_count(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Returns `count` values nearest to `value` and greater by relative `rank`.

# `increment`

```elixir
@spec increment(Aerospike.Exp.t(), Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) ::
  t()
```

Increments the numeric value at `index`. Supports `policy:`.

# `insert`

```elixir
@spec insert(Aerospike.Exp.t(), Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Inserts `value` at `index`. Supports `policy: [flags: flags]`.

# `insert_items`

```elixir
@spec insert_items(Aerospike.Exp.t(), Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) ::
  t()
```

Inserts list expression `values` at `index`. Supports `policy: [flags: flags]`.

# `remove_by_index`

```elixir
@spec remove_by_index(Aerospike.Exp.t(), Aerospike.Exp.t()) :: t()
```

Removes the value at `index`.

# `remove_by_index_range`

```elixir
@spec remove_by_index_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Removes `count` values from `index`, returning selected data.

# `remove_by_index_range_from`

```elixir
@spec remove_by_index_range_from(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Removes values from `index` through the end, returning selected data.

# `remove_by_rank`

```elixir
@spec remove_by_rank(Aerospike.Exp.t(), Aerospike.Exp.t()) :: t()
```

Removes the value at `rank`.

# `remove_by_rank_range`

```elixir
@spec remove_by_rank_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Removes `count` values from `rank`, returning selected data.

# `remove_by_rank_range_from`

```elixir
@spec remove_by_rank_range_from(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Removes values from `rank` through the highest rank, returning selected data.

# `remove_by_value`

```elixir
@spec remove_by_value(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Removes values equal to `value`, returning data selected by `return_type:`.

# `remove_by_value_list`

```elixir
@spec remove_by_value_list(Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Removes values matching any expression in `values`, returning selected data.

# `remove_by_value_range`

```elixir
@spec remove_by_value_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t() | nil,
  Aerospike.Exp.t() | nil,
  opts()
) ::
  t()
```

Removes values in `[begin_value, end_value)`, returning selected data.

# `remove_by_value_rel_rank_range`

```elixir
@spec remove_by_value_rel_rank_range(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) ::
  t()
```

Removes values nearest to `value` and greater by relative `rank`.

# `remove_by_value_rel_rank_range_count`

```elixir
@spec remove_by_value_rel_rank_range_count(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  opts()
) :: t()
```

Removes `count` values nearest to `value` and greater by relative `rank`.

# `return_count`

```elixir
@spec return_count() :: 5
```

Return the selected item count.

# `return_exists`

```elixir
@spec return_exists() :: 13
```

Return whether matching values exist.

# `return_index`

```elixir
@spec return_index() :: 1
```

Return selected item indexes.

# `return_inverted`

```elixir
@spec return_inverted() :: 65536
```

Invert the selector so it applies outside the matched range.

# `return_none`

```elixir
@spec return_none() :: 0
```

Return no result for a selector expression.

# `return_rank`

```elixir
@spec return_rank() :: 3
```

Return selected value ranks.

# `return_reverse_index`

```elixir
@spec return_reverse_index() :: 2
```

Return selected reverse indexes, counted from the list end.

# `return_reverse_rank`

```elixir
@spec return_reverse_rank() :: 4
```

Return selected reverse ranks, counted from the highest value.

# `return_value`

```elixir
@spec return_value() :: 7
```

Return selected value or values.

# `set`

```elixir
@spec set(Aerospike.Exp.t(), Aerospike.Exp.t(), Aerospike.Exp.t(), opts()) :: t()
```

Sets the value at `index`. Supports `policy: [flags: flags]`.

# `size`

```elixir
@spec size(Aerospike.Exp.t()) :: t()
```

Returns the number of values in the list expression.

# `sort`

```elixir
@spec sort(Aerospike.Exp.t(), Aerospike.Op.List.sort_flags() | keyword()) :: t()
```

Sorts the list expression using `sort_flags`.

---

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