# `NebulaGraphEx.Value`
[🔗](https://github.com/VChain/nebula_graph_ex/blob/v0.1.10/lib/nebula_graph_ex/value.ex#L1)

Converts raw `{tag, value}` tuples from `NebulaGraphEx.Thrift.Types` into
idiomatic Elixir terms.

## Mapping

| NebulaGraph type | Elixir term                         |
|------------------|-------------------------------------|
| `null`           | `nil`                               |
| `bool`           | `true` / `false`                    |
| `int`            | `integer()`                         |
| `float`          | `float()`                           |
| `string`         | `binary()`                          |
| `date`           | `%NebulaGraphEx.Types.NebDate{}`     |
| `time`           | `%NebulaGraphEx.Types.NebTime{}`     |
| `datetime`       | `%NebulaGraphEx.Types.NebDateTime{}` |
| `vertex`         | `%NebulaGraphEx.Types.Vertex{}`      |
| `edge`           | `%NebulaGraphEx.Types.Edge{}`        |
| `path`           | `%NebulaGraphEx.Types.Path{}`        |
| `list`           | `list()`                            |
| `map`            | `map()`                             |
| `set`            | `MapSet.t()`                        |
| `dataset`        | `%{column_names: [...], rows: [...]}` |
| `geography`      | `%NebulaGraphEx.Types.Geography{}`   |
| `duration`       | `%NebulaGraphEx.Types.Duration{}`    |

Null subtypes (`:nan`, `:bad_data`, etc.) are preserved as atoms when
the null is not a plain `__NULL__` — use `NebulaGraphEx.Value.null_reason/1`
to inspect them.

# `decode`

```elixir
@spec decode({atom(), term()}) :: term()
```

Converts a raw tagged value produced by `NebulaGraphEx.Thrift.Types` into
an Elixir-native term.

## Examples

    iex> NebulaGraphEx.Value.decode({:integer, 42})
    42

    iex> NebulaGraphEx.Value.decode({:string, "Tim Duncan"})
    "Tim Duncan"

    iex> NebulaGraphEx.Value.decode({:null, nil})
    nil

    iex> NebulaGraphEx.Value.decode({:bool, true})
    true

# `decode_row`

```elixir
@spec decode_row([{atom(), term()}]) :: [term()]
```

Decodes all values in a row list.

# `null_reason`

```elixir
@spec null_reason(term()) :: atom() | nil
```

Returns the null subtype reason atom for a `{:null, reason}` value,
or `nil` if the value is a plain null / not a null at all.

## Examples

    iex> NebulaGraphEx.Value.null_reason({:null, :div_by_zero})
    :div_by_zero

    iex> NebulaGraphEx.Value.null_reason({:null, nil})
    nil

    iex> NebulaGraphEx.Value.null_reason(42)
    nil

---

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