showGraph()
方法及相关接口:
showGraph(commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Graph[]>>
示例:获取所有图集信息
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接,此部分代码省略
let resp = await conn.showGraph();
console.log(resp.data);
};
sdkUsage();
getGraph()
方法及相关接口:
getGraph(req: RequestType.Graph,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Graph>>
interface Graph {
name: string;
}
示例:获取图集amz的信息
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接,此部分代码省略
let resp = await conn.getGraph({ name: "amz" });
console.log(resp.data);
};
sdkUsage();
createGraph()
方法及相关接口:
createGraph(req: RequestType.GraphCreate,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface GraphCreate {
name: string;
desc?: string;
}
示例:创建图集testGraph,设置描述为graphset for test
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接,此部分代码省略
let resp = await conn.createGraph({
name: "testGraph",
desc: "graphset for test"
});
console.log(resp.status.code_desc);
};
sdkUsage();
updateGraph()
方法及相关接口:
updateGraph(req: RequestType.UpdateGraph,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface UpdateGraph {
oldGraphSetName: string;
newGraphSetName?: string;
newDesc?: string;
}
示例:修改图集testGraph的名称为newGraph,修改其描述为rename testGraph as newGraph
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接,此部分代码省略
let resp = await conn.updateGraph({
oldGraphSetName: "testGraph",
newGraphSetName: "newGraph",
newDesc: "rename testGraph as newGraph"
});
console.log(resp.status.code_desc);
};
sdkUsage();
deleteGraph()
方法及相关接口:
deleteGraph(req: RequestType.Graph,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface Graph {
name: string;
}
示例:删除图集newGraph
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接,此部分代码省略
let resp = await conn.deleteGraph({ name: "newGraph" });
console.log(resp.status.code_desc);
};
sdkUsage();