ListGraph()
Method and class:
ListGraph(config *configuration.RequestConfig) (*http.ResponseGraphs, error)
Example: Acquire all graphsets
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn'
responseGraphs, _ := conn.ListGraph(nil)
for i := 0; i < len(responseGraphs.Graphs); i++ {
fmt.Println(*responseGraphs.Graphs[i])
}
}
CreateGraph()
Method and class:
CreateGraph(graph *structs.Graph, config *configuration.RequestConfig) (*http.UQLResponse, error)
Graph struct {
ID types.ID
Name string
Description string
TotalNodes uint64
TotalEdges uint64
Status string
}
Example: Create graphset with name 'testGraph' and description 'graphset for test'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn'
graph := &structs.Graph{
Name: "testGraph",
Description: "graphset for test",
}
uqlResponse, err := conn.CreateGraph(graph, nil)
log.Println(uqlResponse.Status.Code, err)
}
DropGraph()
Method and class:
DropGraph(graphName string, config *configuration.RequestConfig) (*http.UQLResponse, error)
Example: Delete graphset 'newGraph'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn'
uqlResponse, err := conn.DropGraph("testGraph", nil)
log.Println(uqlResponse.Status.Code, err)
}
HasGraph()
Method and class:
HasGraph(graphName string, config *configuration.RequestConfig) (bool, error)
Example: Check if graphset 'newGraph' already exists
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn'
isExist, err := conn.HasGraph("testGraph", nil)
log.Println(isExist, err)
}