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

Bit expression helpers for blob expressions.

# `opts`

```elixir
@type opts() :: [
  flags: atom() | [atom()] | non_neg_integer() | {:raw, non_neg_integer()},
  overflow_action: atom() | non_neg_integer() | {:raw, non_neg_integer()},
  signed: boolean()
]
```

Bit expression modify options.

Supported keys:

* `:flags` - bit-operation write flags. Defaults to `:default`.
* `:overflow_action` - overflow behavior for `add/5` and `subtract/5`.
* `:signed` - when true, adds the signed flag to `:overflow_action`.

# `t`

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

Opaque server-side expression.

# `add`

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

Adds `value` to a sub-integer in the bitmap.

Supports `flags:`, `overflow_action:`, and `signed:`.

# `bw_and`

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

Applies bitwise AND of `value` into the selected bit range.

# `bw_not`

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

Inverts the selected bit range.

# `bw_or`

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

Applies bitwise OR of `value` into the selected bit range.

# `bw_xor`

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

Applies bitwise XOR of `value` into the selected bit range.

# `count`

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

Returns the count of bits set to `1` in the selected range.

# `get`

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

Returns the selected bits as a blob expression.

# `get_int`

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

Reads an integer from the selected bit range, optionally as signed.

# `insert`

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

Inserts a byte-string expression at `byte_offset`.

# `lscan`

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

Returns the offset of the first matching bit when scanning left to right.

# `lshift`

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

Left shifts the selected bit range by `shift` bits.

# `remove`

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

Removes `byte_size` bytes starting at `byte_offset`.

# `resize`

```elixir
@spec resize(
  Aerospike.Exp.t(),
  Aerospike.Exp.t(),
  atom() | [atom()] | non_neg_integer() | {:raw, non_neg_integer()},
  opts()
) :: t()
```

Resizes the blob expression to `byte_size` bytes using `resize_flags`.

# `rscan`

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

Returns the offset of the first matching bit when scanning right to left.

# `rshift`

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

Right shifts the selected bit range by `shift` bits.

# `set`

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

Overwrites a bit range with bits from `value`.

# `set_int`

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

Writes integer `value` into the selected bit range.

# `subtract`

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

Subtracts `value` from a sub-integer in the bitmap.

Supports `flags:`, `overflow_action:`, and `signed:`.

---

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