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.
Summary
Functions
Converts a raw tagged value produced by NebulaGraphEx.Thrift.Types into
an Elixir-native term.
Decodes all values in a row list.
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.
Functions
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
Decodes all values in a row list.
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