NebulaGraphEx.Value (nebula_graph_ex v0.1.10)

Copy Markdown View Source

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

Mapping

NebulaGraph typeElixir term
nullnil
booltrue / false
intinteger()
floatfloat()
stringbinary()
date%NebulaGraphEx.Types.NebDate{}
time%NebulaGraphEx.Types.NebTime{}
datetime%NebulaGraphEx.Types.NebDateTime{}
vertex%NebulaGraphEx.Types.Vertex{}
edge%NebulaGraphEx.Types.Edge{}
path%NebulaGraphEx.Types.Path{}
listlist()
mapmap()
setMapSet.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

decode(other)

@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(values)

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

Decodes all values in a row list.

null_reason(arg1)

@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