NebulaGraphEx.Thrift.Types (nebula_graph_ex v0.1.10)

Copy Markdown View Source

Thrift binary encoding and decoding of NebulaGraph data types.

This module handles the Value union, DataSet, Row, Vertex, Edge, Path, and all other types defined in priv/thrift/common.thrift.

Value union field IDs

The Value union in the Thrift IDL maps to these field IDs:

FieldIDElixir type
nVal1NullType (i32)
bVal2bool
iVal3i64
fVal4double
sVal5binary
dVal6Date struct
tVal7Time struct
dtVal8DateTime struct
vVal9Vertex struct
eVal10Edge struct
pVal11Path struct
lVal12NList struct
mVal13NMap struct
uVal14NSet struct
gVal15DataSet struct
ggVal16Geography union
duVal17Duration struct

Summary

Functions

Decodes a Thrift DataSet struct from binary.

Decodes a single Row struct. Returns {list_of_raw_values, rest}.

Decodes a Value union struct from binary.

Encodes an Elixir value as a Thrift Value union struct.

Functions

decode_dataset(data)

@spec decode_dataset(binary()) :: {map(), binary()}

Decodes a Thrift DataSet struct from binary.

Returns {dataset_map, rest} where dataset_map has:

  • :column_names — list of binary column names
  • :rows — list of decoded row value lists

decode_row(data)

@spec decode_row(binary()) :: {list(), binary()}

Decodes a single Row struct. Returns {list_of_raw_values, rest}.

Each element in the list is a raw tagged value map as produced by decode_value/1. NebulaGraphEx.Value.decode/1 converts these to native Elixir types.

decode_value(data)

@spec decode_value(binary()) :: {{atom(), term()}, binary()}

Decodes a Value union struct from binary.

Returns {{tag, value}, rest} where tag is one of: :null, :bool, :integer, :float, :string, :date, :time, :datetime, :vertex, :edge, :path, :list, :map, :set, :dataset, :geography, :duration.

encode_value(v)

@spec encode_value(term()) :: iodata()

Encodes an Elixir value as a Thrift Value union struct.

Supported types:

  • nilnVal (NullType.NULL)
  • booleanbVal
  • integeriVal
  • floatfVal
  • binarysVal
  • DatedVal
  • DateTimedtVal
  • TimetVal