NebulaGraphEx.Query (nebula_graph_ex v0.1.10)

Copy Markdown View Source

Represents a nGQL query to be executed against NebulaGraph.

You typically do not build %Query{} structs directly — use NebulaGraphEx.Graph.query/4 instead. The struct is part of the public API so that callers can introspect prepared queries or pass them to DBConnection.execute/4 directly when using the connection without the pool.

Fields

  • :statement — nGQL string to execute
  • :params — map of binary keys to parameter values (for executeWithParameter)
  • :opts — per-query option overrides (see NebulaGraphEx.Options)

Summary

Types

t()

@type t() :: %NebulaGraphEx.Query{
  opts: keyword(),
  params: map(),
  statement: String.t()
}

Functions

new(statement, params \\ %{}, opts \\ [])

@spec new(String.t(), map(), keyword()) :: t()

Builds a %Query{} struct.

Examples

iex> NebulaGraphEx.Query.new("RETURN 1")
%NebulaGraphEx.Query{statement: "RETURN 1", params: %{}, opts: []}

iex> NebulaGraphEx.Query.new(
...>   "MATCH (v:Player{name: $name}) RETURN v",
...>   %{"name" => "Tim Duncan"}
...> )
%NebulaGraphEx.Query{
  statement: "MATCH (v:Player{name: $name}) RETURN v",
  params: %{"name" => "Tim Duncan"},
  opts: []
}