A decoded NebulaGraph result set with a convenient row/column API.
NebulaGraphEx.Graph.query/4 returns a %ResultSet{} on success. Each row
is a %NebulaGraphEx.Record{} with fully decoded Elixir values.
Example
{:ok, rs} = NebulaGraphEx.Graph.query(conn, "MATCH (v:Player) RETURN v.name, v.age LIMIT 3")
rs |> NebulaGraphEx.ResultSet.columns()
#=> ["v.name", "v.age"]
rs |> NebulaGraphEx.ResultSet.count()
#=> 3
rs |> NebulaGraphEx.ResultSet.rows() |> Enum.map(&NebulaGraphEx.Record.to_map/1)
#=> [%{"v.name" => "Tim Duncan", "v.age" => 42}, ...]
Summary
Functions
Returns the ordered list of column name strings.
Returns the number of rows in the result set.
Returns true if the result set has no rows.
Returns the first %Record{}, or nil if the result set is empty.
Returns the first %Record{}, raising RuntimeError if the result is empty.
Server-side execution latency in microseconds.
Maps a function over every row. Equivalent to Enum.map(rows(rs), fun).
Returns the single row, raising if there is not exactly one.
Returns all rows as a list of %NebulaGraphEx.Record{} structs.
Returns all rows as a list of plain maps (%{column_name => value}).
Types
@type t() :: %NebulaGraphEx.ResultSet{ columns: [String.t()], comment: String.t() | nil, latency_us: non_neg_integer(), num_rows: non_neg_integer(), rows: [NebulaGraphEx.Record.t()], space_name: String.t() | nil, statement: String.t() }
Functions
Returns the ordered list of column name strings.
@spec count(t()) :: non_neg_integer()
Returns the number of rows in the result set.
Returns true if the result set has no rows.
@spec first(t()) :: NebulaGraphEx.Record.t() | nil
Returns the first %Record{}, or nil if the result set is empty.
@spec first!(t()) :: NebulaGraphEx.Record.t()
Returns the first %Record{}, raising RuntimeError if the result is empty.
@spec latency_us(t()) :: non_neg_integer()
Server-side execution latency in microseconds.
@spec map(t(), (NebulaGraphEx.Record.t() -> term())) :: [term()]
Maps a function over every row. Equivalent to Enum.map(rows(rs), fun).
@spec one!(t()) :: NebulaGraphEx.Record.t()
Returns the single row, raising if there is not exactly one.
@spec rows(t()) :: [NebulaGraphEx.Record.t()]
Returns all rows as a list of %NebulaGraphEx.Record{} structs.
Returns all rows as a list of plain maps (%{column_name => value}).
Convenient for JSON serialisation or pattern matching on column names.