UltipaDocs
Try Playground
  • Introduction
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Installation
    • Connection
    • Request Configuration
    • UQL Execution
    • GQL Execution
    • Graphset Management
    • Schema and Property Management
    • Data Insertion and Deletion
    • Query Acceleration
    • Algorithm Management
    • Downloads and Exports
    • Process and Task Management
    • Access Management
    • Server Statistics
    • Result Processing
    • Types Mapping Ultipa and C#
  • RESTful API
  1. Docs
  2. /
  3. Ultipa Drivers
  4. /
  5. Go

Data Structures

This section introduces the core data structures provided by the driver.

Node

Node includes the following fields:

Field
Type
Description
UUIDtypes.UUID (uint64)Node _uuid.
IDtypes.ID (string)Node _id.
SchemastringName of the schema the node belongs to.
Valuesmap[string]interface{}{}Node property key-value pairs.

If a query returns nodes, you can use AsNodes() to convert them into a list of Nodes.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH (n:User) RETURN n LIMIT 2", requestConfig)
nodes, _, _ := response.Alias("n").AsNodes()
for _, node := range nodes {
  jsonData, err := json.MarshalIndent(node, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}
Output
{
  "ID": "U4",
  "UUID": 6557243256474697731,
  "Schema": "User",
  "Values": {
    "Data": {
      "name": "mochaeach"
    }
  }
}
{
  "ID": "U2",
  "UUID": 7926337543195328514,
  "Schema": "User",
  "Values": {
    "Data": {
      "name": "Brainy"
    }
  }
}

Edge

Edge includes the following fields:

Field
Type
Description
UUIDtyeps.UUID (uint64)Edge _uuid.
FromUUIDtypes.UUID (uint64)_uuid of the source node of the edge.
ToUUIDtypes.UUID (uint64)_uuid of the destination node of the edge.
Fromtypes.ID (string)_id of the source node of the edge.
Totypes.ID (string)_id of the destination node of the edge.
SchemastringName of the schema the edge belongs to.
Valuesmap[string]interface{}{}Edge property key-value pairs.

If a query returns edges, you can use AsEdges() to convert them into a list of Edges.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH ()-[e]->() RETURN e LIMIT 2", requestConfig)
edges, _, _ := response.Alias("e").AsEdges()
for _, edge := range edges {
  jsonData, err := json.MarshalIndent(edge, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}
Output
{
  "UUID": 2,
  "FromUUID": 6557243256474697731,
  "ToUUID": 7926337543195328514,
  "From": "U4",
  "To": "U2",
  "Schema": "Follows",
  "Values": {
    "Data": {
      "createdOn": "2024-02-10"
    }
  }
}
{
  "UUID": 3,
  "FromUUID": 7926337543195328514,
  "ToUUID": 17870285520429383683,
  "From": "U2",
  "To": "U3",
  "Schema": "Follows",
  "Values": {
    "Data": {
      "createdOn": "2024-02-01"
    }
  }
}

Path

Path includes the following fields:

Field
Type
Description
NodeUUIDs[]types.UUIDThe list of node _uuids in the path.
EdgeUUIDs[]types.UUIDThe list of edge _uuids in the path.
Nodesmap[types.UUID]*NodeA map of nodes in the path, where the key is the node’s _uuid, and the value is the corresponding node.
Edgesmap[types.UUID]*EdgeA map of edges in the path, where the key is the edge’s _uuid, and the value is the corresponding edge.

Methods on Path:

Method
Parameters
Returns
Description
Length()/intReturns the number of edges in the path.

If a query returns paths, you can use AsGraph() to convert them into a Graph; Graph provides access to the returned paths.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH p = ()-[]->() RETURN p LIMIT 2", requestConfig)
graph, _ := response.Alias("p").AsGraph()
paths := graph.Paths
for _, path := range paths {
  fmt.Println("Node _uuids:", path.NodeUUIDs, "Length:", path.Length())
}
Output
Node _uuids: [6557243256474697731 7926337543195328514] Length: 1
Node _uuids: [7926337543195328514 17870285520429383683] Length: 1

Graph

Graph includes the following fields:

Field
Type
Description
Paths[]*PathThe list of returned paths.
Nodesmap[types.UUID]*NodeA map of unique nodes in the graph, where the key is the node’s _uuid, and the value is the corresponding node.
Edgesmap[types.UUID]*EdgeA map of unique edges in the graph, where the key is the edge’s _uuid, and the value is the corresponding edge.

Methods on Graph:

Method
Parameters
Returns
Description
AddNode()node: *Node/Adds a Node to the graph. Duplicate nodes are not added; Nodes remains unique.
AddEdge()edge: *Edge/Adds an Edge to the graph. Duplicate edges are not added; Edges remains unique.

If a query returns paths, you can use AsGraph() to convert them into a Graph.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH p = ()-[]->() RETURN p LIMIT 2", requestConfig)
graph, _ := response.Alias("p").AsGraph()
fmt.Println("Unique nodes UUID:")
for _, node := range graph.Nodes {
  fmt.Println(node.UUID)
}
fmt.Println("Unique edges UUID:")
for _, edge := range graph.Edges {
  fmt.Println(edge.UUID)
}
fmt.Println("All paths:")
for i, path := range graph.Paths {
  fmt.Println("Path", i, "has nodes", path.NodeUUIDs, "and edges", path.EdgeUUIDs)
}
Output
Unique nodes UUID:
6557243256474697731
7926337543195328514
17870285520429383683
Unique edges UUID:
2
3
All paths:
Path 0 has nodes [6557243256474697731 7926337543195328514] and edges [2]
Path 1 has nodes [7926337543195328514 17870285520429383683] and edges [3]

GraphSet

GraphSet includes the following fields:

Field
Type
Description
IDtypes.ID (string)Graph ID.
NamestringGraph name.
TotalNodesuint64Total number of nodes in the graph.
TotalEdgesuint64Total number of edges in the graph.
Shards[]stringThe list of IDs of shard servers where the graph is stored.
PartitionBystringThe hash function used for graph sharding, which can be Crc32 (default), Crc64WE, Crc64XZ, or CityHash64.
StatusstringGraph status, which can be NORMAL, LOADING_SNAPSHOT, CREATING, DROPPING, or SCALING.
DescriptionstringGraph description.
SlotNumintThe number of slots used for graph sharding.

If a query retrieves graphs (graphsets) in the database, you can use AsGraphSets() to convert them into a list of GraphSets.

Go
response, _ := driver.Gql("SHOW GRAPH", nil)
graphsets, _ := response.Get(0).AsGraphSets()
for _, graphset := range graphsets {
  fmt.Println(graphset.Name)
}

The ShowGraph() method also retrieves graphs (graphsets) in the database, it returns a list of GraphSets directly.

Go
graphsets, _ := driver.ShowGraph(nil)
for _, graphset := range graphsets {
  fmt.Println(graphset.Name)
}
Output
g1
miniCircle
amz

Schema

Schema includes the following fields:

Field
Type
Description
NamestringSchema name
DBTypeultipa.DBTypeDBNODE
Properties[]*PropertyThe list of properties associated with the schema.
DescriptionstringSchema description
Totaluint64Total number of nodes or edges belonging to the schema.
IdstringSchema ID.
Stats[]*SchemaStatA list of SchemaStat values; each SchemaStat includes fields Schema (schema name), DBType (schema type), FromSchema (source node schema), ToSchema (destination node schema), and Count (count of nodes or edges).

If a query retrieves node or edge schemas defined in a graph, you can use AsSchemas() to convert them into a list of Schemas.

Go
requestConfig := &configuration.RequestConfig{Graph: "miniCircle"}
response, _ := driver.Gql("SHOW NODE SCHEMA", requestConfig)
schemas, _ := response.Get(0).AsSchemas()
for _, schema := range schemas {
  fmt.Println(schema.Name)
}

The ShowSchema(), ShowNodeSchema() and ShowEdgeSchema() methods also retrieve node and edge schemas in a graph, it returns a list of Schemas directly.

Go
requestConfig := &configuration.RequestConfig{Graph: "miniCircle"}
schemas, _ := driver.ShowNodeSchema(requestConfig)
for _, schema := range schemas {
  fmt.Println(schema.Name)
}
Output
default
account
celebrity
country
movie

Property

Property includes the following fields:

Field
Type
Description
NamestringProperty name.
Typeultipa.PropertyTypeUNSET
SubTypes[]ultipa.PropertyTypeIf the Type is LIST or SET, sets its element type; only one ultipa.PropertyType is allowed in the list.
SchemastringThe associated schema of the property.
DescriptionstringProperty description.
LteboolWhether the property is LTE-ed.
ReadboolWhether the property is readable.
WriteboolWhether the property can be written.
EncryptstringEncryption method of the property, which can be AES128, AES256, RSA, or ECC.
DecimalExtra*DecimalExtraThe precision (1–65) and scale (0–30) of the DECIMAL type.

If a query retrieves node or edge properties defined in a graph, you can use AsProperties() to convert them into a list of Propertys.

Go
requestConfig := &configuration.RequestConfig{Graph: "miniCircle"}
response, _ := driver.Gql("SHOW NODE account PROPERTY", requestConfig)
properties, _ := response.Get(0).AsProperties()
for _, property := range properties {
  fmt.Println(property.Name)
}

The ShowProperty(), ShowNodeProperty() and ShowEdgeProperty() methods also retrieve node and edge properties in a graph, it returns a list of Propertys directly.

Go
requestConfig := &configuration.RequestConfig{Graph: "miniCircle"}
properties, _ := driver.ShowNodeProperty("account", requestConfig)
for _, property := range properties {
  fmt.Println(property.Name)
}
Output
_id
gender
year
industry
name

Attr

Attr includes the following fields:

Field
Type
Description
NamestringName of the returned alias.
ValuesValueThe returned values.
PropertyTypeultipa.PropertyTypeType of the property.
ResultTypeultipa.ResultTypeType of the results, which can be RESULT_TYPE_NODE, RESULT_TYPE_EDGE, RESULT_TYPE_PATH, RESULT_TYPE_ATTR, RESULT_TYPE_TABLE, or RESULT_TYPE_UNSET.

If a query returns results like property values, expressions, or computed values, you can use AsAttr() to convert them into an Attr.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH (n:User) LIMIT 2 RETURN n.name", requestConfig)
attr, _ := response.Alias("n.name").AsAttr()
jsonData, err := json.MarshalIndent(attr, "", "  ")
if err != nil {
  fmt.Println("Error:", err)
}
fmt.Println(string(jsonData))
Output
{
  "Name": "n.name",
  "PropertyType": 7,
  "ResultType": 4,
  "Values": [
    "mochaeach",
    "Brainy"
  ]
}

Table

Table includes the following fields:

Field
Type
Description
NamestringTable name.
Headers[]*HeaderTable headers.
Rows[]*ValuesTable rows.

Methods on Table:

Method
Parameters
Returns
Description
ToKV()/[]*ValuesConvert all rows in the table to a list of maps.

If a query uses the table() function to return a set of rows and columns, you can use AsTable() to convert them into a Table.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("MATCH (n:User) LIMIT 2 RETURN table(n._id, n.name) AS result", requestConfig)
table, _ := response.Get(0).AsTable()
jsonData, err := json.MarshalIndent(table, "", "  ")
if err != nil {
  fmt.Println("Error:", err)
}
fmt.Println(string(jsonData))
Output
{
  "Name": "result",
  "Headers": [
    {
      "Name": "n._id",
      "PropertyType": 7
    },
    {
      "Name": "n.name",
      "PropertyType": 7
    }
  ],
  "Rows": [
    [
      "U4",
      "mochaeach"
    ],
    [
      "U2",
      "Brainy"
    ]
  ]
}

HDCGraph

HDCGraph includes the following fields:

Field
Type
Description
NamestringHDC graph name.
GraphNamestringThe source graph from which the HDC graph is created.
StatusstringHDC graph status.
StatsstringStatistics of the HDC graph.
IsDefaultstringWhether it is the default HDC graph of the source graph.
HdcServerNamestringName of the HDC server that hosts the HDC graph.
HdcServerStatusstringStatus of the HDC server that hosts the HDC graph.
ConfigstringConfigurations of the HDC graph.

If a query retrieves HDC graphs of a graph, you can use AsHDCGraphs() to convert them into a list of HDCGraphs.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("SHOW HDC GRAPH", requestConfig)
hdcGraphs, _ := response.Get(0).AsHDCGraphs()
for _, hdchdcGraph := range hdcGraphs {
  fmt.Println(hdchdcGraph.Name)
}

The ShowHDCGraph() method also retrieves HDC graphs of a graph, it returns a list of HDCGraphs directly.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
hdcGraphs, _ := driver.ShowHDCGraph(requestConfig)
for _, hdchdcGraph := range hdcGraphs {
  fmt.Println(hdchdcGraph.Name)
}
Output
g1_hdc_full
g1_hdc_nodes

Algo

Algo includes the following fields:

Field
Type
Description
NamestringAlgorithm name.
TypestringAlgorithm type.
VersionstringAlgorithm version.
Params[]*AlgoParamAlgorithm parameters, each AlgoParam has fields Name and Desc.
WriteSupportTypestringThe writeback types supported by the algorithm.
CanRollbackstringWhether the algorithm version supports rollback.
ConfigContextstringThe configurations of the algorithm.

If a query retrieves algorithms installed on an HDC server of the database, you can use AsAlgos() to convert them into a list of Algos.

Go
response, _ := driver.Gql("SHOW HDC ALGO ON 'hdc-server-1'", nil)
algos, _ := response.Get(0).AsAlgos()
for _, algo := range algos {
  if algo.Type != "algo" {
    continue
  }
  fmt.Println(algo.Name)
}

The ShowHDCAlgo() method also retrieves algorithms installed on an HDC server of the database, it returns a list of Algos directly.

Go
algos, _ := driver.ShowHDCAlgo("hdc-server-1", nil)
for _, algo := range algos {
  if algo.Type != "algo" {
    continue
  }
  fmt.Println(algo.Name)
}
Output
bipartite
fastRP

Projection

Projection includes the following fields:

Field
Type
Description
NamestringProjection name.
GraphNamestringThe source graph from which the projection is created.
StatusstringProjection status.
StatsstringStatistics of the projection.
ConfigstringConfigurations of the projection.

If a query retrieves projections of a graph, you can use AsProjections() to convert them into a list of Projections.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("SHOW PROJECTION", requestConfig)
projections, _ := response.Get(0).AsProjections()
for _, projection := range projections {
  fmt.Println(projection.Name)
}
Output
distG1
distG1_nodes

Index

Index includes the following fields:

Field
Type
Description
IdstringIndex ID.
NamestringIndex name.
PropertiesstringProperties associated with the index.
SchemastringThe schema associated with the index
StatusstringIndex status.
DBTypeultipa.DBTypeIndex type, which can be DBNODE or DBEDGE.

If a query retrieves node or edge indexes of a graph, you can use AsIndexes() to convert them into a list of Indexs.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("SHOW NODE INDEX", requestConfig)
indexes, _ := response.Get(0).AsIndexes()
for _, index := range indexes {
  jsonData, err := json.MarshalIndent(index, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}

The ShowIndex(), ShowNodeIndex(), and ShowEdgeIndex() methods also retrieve indexes of a graph, it returns a list of Indexs directly.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
indexes, _ := driver.ShowIndex(requestConfig)
for _, index := range indexes {
  jsonData, err := json.MarshalIndent(index, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}
Output
{
  "Id": "1",
  "Name": "User_name",
  "Properties": "name(1024)",
  "Schema": "User",
  "Status": "DONE",
  "DBType": 0
}

Privilege

Privilege includes the following fields:

Field
Type
Description
NamestringPrivilege name.
LevelPrivilegeLevelPrivilege level, which can be SystemPrivilege or GraphPrivilege.

If a query retrieves privileges defined in Ultipa, you can use AsPrivileges() to convert them into a list of Privileges.

Go
response, _ := driver.Uql("show().privilege()", nil)
privileges, _ := response.Get(0).AsPrivileges()

var graphPrivileges []string
var systemPrivileges []string

for _, privilege := range privileges {
  if privilege.Level == structs.GraphPrivilege {
    graphPrivileges = append(graphPrivileges, privilege.Name)
  } else {
    systemPrivileges = append(systemPrivileges, privilege.Name)
  }
}

The ShowPrivilege() method also retrieves privileges defined in Ultipa, it returns a list of Privileges directly.

Go
privileges, _ := driver.ShowPrivilege(nil)

var graphPrivileges []string
var systemPrivileges []string

for _, privilege := range privileges {
  if privilege.Level == structs.GraphPrivilege {
    graphPrivileges = append(graphPrivileges, privilege.Name)
  } else {
    systemPrivileges = append(systemPrivileges, privilege.Name)
  }
}

fmt.Println("Graph Privileges:", graphPrivileges)
fmt.Println("System Privileges:", systemPrivileges)
Output
Graph Privileges: [READ INSERT UPSERT UPDATE DELETE CREATE_SCHEMA DROP_SCHEMA ALTER_SCHEMA SHOW_SCHEMA RELOAD_SCHEMA CREATE_PROPERTY DROP_PROPERTY ALTER_PROPERTY SHOW_PROPERTY CREATE_FULLTEXT DROP_FULLTEXT SHOW_FULLTEXT CREATE_INDEX DROP_INDEX SHOW_INDEX LTE UFE CLEAR_JOB STOP_JOB SHOW_JOB ALGO CREATE_PROJECT SHOW_PROJECT DROP_PROJECT CREATE_HDC_GRAPH SHOW_HDC_GRAPH DROP_HDC_GRAPH COMPACT_HDC_GRAPH SHOW_VECTOR_INDEX CREATE_VECTOR_INDEX DROP_VECTOR_INDEX SHOW_CONSTRAINT CREATE_CONSTRAINT DROP_CONSTRAINT]
System Privileges: [TRUNCATE COMPACT CREATE_GRAPH SHOW_GRAPH DROP_GRAPH ALTER_GRAPH CREATE_GRAPH_TYPE SHOW_GRAPH_TYPE DROP_GRAPH_TYPE TOP KILL STAT SHOW_POLICY CREATE_POLICY DROP_POLICY ALTER_POLICY SHOW_USER CREATE_USER DROP_USER ALTER_USER SHOW_PRIVILEGE SHOW_META SHOW_SHARD ADD_SHARD DELETE_SHARD REPLACE_SHARD SHOW_HDC_SERVER ADD_HDC_SERVER DELETE_HDC_SERVER LICENSE_UPDATE LICENSE_DUMP GRANT REVOKE SHOW_BACKUP CREATE_BACKUP SHOW_VECTOR_SERVER ADD_VECTOR_SERVER DELETE_VECTOR_SERVER]

Policy

Policy includes the following fields:

Field
Type
Description
NamestringPolicy name.
SystemPrivileges[]stringSystem privileges included in the policy.
GraphPrivilegesGraphPrivilegesGraph privileges included in the policy; in the map, the key is the name of the graph, and the value is the corresponding graph privileges.
PropertyPrivilegesPropertyPrivilegesProperty privileges included in the policy; the PropertyPrivilege has fields Node and Edge, both are PropertyPrivilegeElement values.
policies[]stringPolicies included in the policy.

PropertyPrivilegeElement includes the following fields:

Field
Type
Description
Read[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.
Write[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.
Deny[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.

If a query retrieves policies (roles) defined in the database, you can use AsPolicies() to convert them into a list of Policys.

Go
response, _ := driver.Gql("SHOW ROLE", nil)
policies, _ := response.Get(0).AsPolicies()
for _, policy := range policies {
  fmt.Println(policy.Name)
}

The ShowPolicy() method also retrieves policies (roles) defined in the database, it returns a list of Policys directly.

Go
policies, _ := driver.ShowPolicy(nil)
for _, policy := range policies {
  fmt.Println(policy.Name)
}
Output
manager
Tester
operator
superADM

User

User includes the following fields:

Field
Type
Description
UsernamestringUsername.
PasswordstringPassword.
CreatedTimestringThe time when the user was created.
SystemPrivileges[]stringSystem privileges granted to the user.
GraphPrivilegesGraphPrivilegesGraph privileges granted to the user; in the dictionary, the key is the name of the graph, and the value is the corresponding graph privileges.
propertyPrivilegesPropertyPrivilegeProperty privileges granted to the user; the PropertyPrivilege has fields Node and Edge, both are PropertyPrivilegeElement values.
policies[]stringPolicies granted to the user.

PropertyPrivilegeElement includes the following fields:

Field
Type
Description
Read[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.
Write[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.
Deny[][]stringA list of lists; each inner list contains three strings representing the graph, schema, and property.

If a query retrieves database users, you can use AsUsers() to convert them into a list of Users.

Go
response, _ := driver.Gql("SHOW USER", nil)
users, _ := response.Get(0).AsUsers()
for _, user := range users {
  fmt.Println(user.UserName)
}

The ShowUser() method also retrieves database users, it returns a list of Users directly.

Go
users, _ := driver.ShowUser(nil)
for _, user := range users {
  fmt.Println(user.UserName)
}
Output
user01
root
johndoe

Process

Process includes the following fields:

Field
Type
Description
ProcessIdstringProcess ID.
ProcessQuerystringThe query that the process executes.
StatusstringProcess status.
DurationstringThe duration (in seconds) the process has run.

If a query retrieves processes running in the database, you can use AsProcesses() to convert them into a list of Processs.

Go
response, _ := driver.Gql("TOP", nil)
processes, _ := response.Get(0).AsProcesses()
for _, process := range processes {
  jsonData, err := json.MarshalIndent(process, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}

The Top() method also retrieves processes running in the database, it returns a list of Processs directly.

Go
processes, _ := driver.Top(nil)
for _, process := range processes {
  jsonData, err := json.MarshalIndent(process, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}
Output
{
  "process_id": "3145773",
  "status": "RUNNING",
  "process_query": "MATCH p=()-{1,5}() RETURN p",
  "duration": "2"
}

Job

Job includes the following fields:

Field
Type
Description
IdstringJob ID.
GraphNamestringName of the graph where the job executes on.
QuerystringThe query that the job executes.
TypestringJob type.
ErrNsgstringError message of the job.
Resultmap[string]stringResult of the job.
StartTimestringThe time when the job begins.
EndTimestringThe times when the job ends.
StatusstringJob status.
ProgressstringProgress updates for the job, such as indications that the write operation has been started.

If a query retrieves jobs of a graph, you can use asJobs() to convert them into a list of Jobs.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
response, _ := driver.Gql("SHOW JOB", requestConfig)
jobs, _ := response.Get(0).AsJobs()
for _, job := range jobs {
  jsonData, err := json.MarshalIndent(job, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}

The ShowJob() method also retrieves processes running in the database, it returns a list of Jobs directly.

Go
requestConfig := &configuration.RequestConfig{Graph: "g1"}
jobs, _ := driver.ShowJob("", requestConfig)
for _, job := range jobs {
  jsonData, err := json.MarshalIndent(job, "", "  ")
  if err != nil {
    fmt.Println("Error:", err)
    continue
  }
  fmt.Println(string(jsonData))
}
Output
{
  "job_id": "6",
  "graph_name": "g1",
  "type": "CREATE_INDEX",
  "query": "CREATE INDEX User_name ON NODE User (name)",
  "status": "FINISHED",
  "err_msg": "",
  "result": null,
  "start_time": "2025-09-30 18:23:48",
  "end_time": "2025-09-30 18:23:49",
  "progress": ""
}
{
  "job_id": "6_1",
  "graph_name": "g1",
  "type": "CREATE_INDEX",
  "query": "",
  "status": "FINISHED",
  "err_msg": "",
  "result": null,
  "start_time": "2025-09-30 18:23:49",
  "end_time": "2025-09-30 18:23:49",
  "progress": ""
}
{
  "job_id": "6_2",
  "graph_name": "g1",
  "type": "CREATE_INDEX",
  "query": "",
  "status": "FINISHED",
  "err_msg": "",
  "result": null,
  "start_time": "2025-09-30 18:23:49",
  "end_time": "2025-09-30 18:23:49",
  "progress": ""
}