NebulaGraphEx.Types.Vertex (nebula_graph_ex v0.1.10)

Copy Markdown View Source

Represents a NebulaGraph vertex (node).

A vertex has a vid (vertex ID, either an integer or string depending on the space's VID type) and a list of %NebulaGraphEx.Types.Tag{} structs, each carrying a set of properties.

Fields

  • :vid — vertex ID; decoded to integer() or binary().
  • :tags — list of %NebulaGraphEx.Types.Tag{} structs.

Example

%NebulaGraphEx.Types.Vertex{
  vid: "player100",
  tags: [
    %NebulaGraphEx.Types.Tag{
      name: "Player",
      props: %{"name" => "Tim Duncan", "age" => 42}
    }
  ]
}

Summary

Functions

Returns the property value for prop_name in the first tag named tag_name, or nil if either the tag or the property is absent.

Returns the first tag matching name, or nil if not present.

Types

t()

@type t() :: %NebulaGraphEx.Types.Vertex{
  tags: [NebulaGraphEx.Types.Tag.t()],
  vid: integer() | String.t()
}

Functions

prop(vertex, tag_name, prop_name)

@spec prop(t(), String.t(), String.t()) :: term()

Returns the property value for prop_name in the first tag named tag_name, or nil if either the tag or the property is absent.

tag(vertex, name)

@spec tag(t(), String.t()) :: NebulaGraphEx.Types.Tag.t() | nil

Returns the first tag matching name, or nil if not present.

Example

Vertex.tag(vertex, "Player")
#=> %Tag{name: "Player", props: %{"name" => "Tim Duncan"}}