本文整理汇总了TypeScript中arangojs.Graph类的典型用法代码示例。如果您正苦于以下问题:TypeScript Graph类的具体用法?TypeScript Graph怎么用?TypeScript Graph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Graph类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getAllVertexCollections
/**
* Fetches all vertex collections from the database and returns an array
* of GraphVertexCollection instances for the collections.
*
* @param {boolean} excludeOrphans Whether orphan collections should be excluded.
* @return {Array<Object>} vertex list
*/
async getAllVertexCollections(excludeOrphans?: boolean): Promise<any> {
if (_.isNil(excludeOrphans)) {
excludeOrphans = false;
}
const collections = await this.graph.vertexCollections({ excludeOrphans });
return collections;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:14,代码来源:graph.ts
示例2: getVertexCollection
/**
* gets a new GraphVertexCollection instance with the given name for this graph.
*
* @param {string} collectionName The handle of the vertex to retrieve.
* This can be either the _id or the _key of a vertex in the collection,
* or a vertex (i.e. an object with an _id or _key property).
* @return {Object} created vertex
*/
async getVertexCollection(collectionName: string): Promise<Object> {
if (_.isNil(collectionName)) {
throw new Error('missing vertex collection name');
}
const collection = await this.graph.vertexCollection(collectionName);
return collection;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:16,代码来源:graph.ts
示例3: removeEdgeDefinition
/**
* Removes the edge definition with the given definitionName form the graph.
*
* @param {string} definitionName Name of the edge definition
* to remove from the graph.
* @param {boolean} dropCollection If set to true, the edge collection
* associated with the definition will also be deleted from the database.
* @return {Object} replaced edge definition
*/
async removeEdgeDefinition(definitionName: string, dropCollection?: boolean):
Promise<Object> {
if (_.isNil(definitionName)) {
throw new Error('missing definition name');
}
return this.graph.removeEdgeDefinition(definitionName, dropCollection);
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:16,代码来源:graph.ts
示例4: listVertexCollections
/**
* Fetches all vertex collections from the graph and returns
* an array of collection descriptions.
*
* @param {boolean} excludeOrphans Whether orphan collections should be excluded.
* @return {Array<Object>} vertex list
*/
async listVertexCollections(excludeOrphans?: boolean): Promise<any> {
if (!excludeOrphans) {
excludeOrphans = false;
}
const collections = await this.graph.listVertexCollections({ excludeOrphans });
return collections;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:14,代码来源:graph.ts
示例5: removeEdge
/**
* Deletes the edge with the given documentHandle from the collection.
*
* @param {string} collectionName edge collection name
* @param {string} documentHandle The handle of the edge to retrieve.
* This can be either the _id or the _key of an edge in the collection,
* or an edge (i.e. an object with an _id or _key property).
* @return {Object} removed Edge
*/
async removeEdge(collectionName: string, documentHandle: string): Promise<any> {
if (_.isNil(collectionName)) {
throw new Error('missing edge collection name');
}
if (_.isNil(documentHandle)) {
throw new Error('missing document handle');
}
const collection = this.graph.edgeCollection(collectionName);
return collection.remove(documentHandle);
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:19,代码来源:graph.ts
示例6: getVertex
/**
* Retreives the vertex with the given documentHandle from the collection.
*
* @param {string} collectionName vertex collection name
* @param {string} documentHandle The handle of the vertex to retrieve.
* This can be either the _id or the _key of a vertex in the collection,
* or a vertex (i.e. an object with an _id or _key property).
* @return {Object} created vertex
*/
async getVertex(collectionName: string, documentHandle: string): Promise<Object> {
if (_.isNil(collectionName)) {
throw new Error('missing vertex collection name');
}
if (_.isNil(documentHandle)) {
throw new Error('missing document handle');
}
const collection = this.graph.vertexCollection(collectionName);
const doc = await collection.vertex(documentHandle);
return doc;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:20,代码来源:graph.ts
示例7: getOutEdges
/**
* get all outgoing edges.
*
* @param {String} collectionName edge collection name
* @param {String} documentHandle The handle of the document
* @return {[Object]} list of edges
*/
async getOutEdges(collectionName: string, documentHandle: string):
Promise<[Object]> {
if (_.isNil(collectionName)) {
throw new Error('missing edge collection name');
}
if (_.isNil(documentHandle)) {
throw new Error('missing document handle');
}
const collection = this.graph.edgeCollection(collectionName);
return collection.outEdges(documentHandle);
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:18,代码来源:graph.ts
示例8: replaceEdgeDefinition
/**
* Replaces the edge definition for the edge collection named
* collectionName with the given definition.
*
* @param {string} collectionName Name of the edge collection
* to replace the definition of.
* @param {Object} definition
* @return {Object} replaced edge definition
*/
async replaceEdgeDefinition(collectionName: string, definition: Object):
Promise<Object> {
if (_.isNil(collectionName)) {
throw new Error('missing edge collection name');
}
if (_.isNil(definition)) {
throw new Error('missing edge definition');
}
return this.graph.replaceEdgeDefinition(collectionName, definition);
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:20,代码来源:graph.ts
示例9: createEdge
/**
* Creates a new edge between the vertices fromId and toId with the given data.
*
* @param {string} collectionName name of the edge collection
* @param {Object} data The data of the new edge. If fromId and toId are not
* specified, the data needs to contain the properties _from and _to.
* @param {string} fromId The handle of the start vertex of this edge.
* This can be either the _id of a document in the database, the _key of an
* edge in the collection, or a document (i.e. an object with an _id or _key property).
* @param {string} toId The handle of the end vertex of this edge.
* This can be either the _id of a document in the database, the _key of an
* edge in the collection, or a document (i.e. an object with an _id or _key property).
* @return {Object} edge object
*/
async createEdge(collectionName: string, data: Object, fromId?: string,
toId?: string): Promise<Object> {
if (_.isNil(collectionName)) {
throw new Error('missing edge collection name');
}
if (_.isNil(data)) {
data = {};
}
const collection = this.graph.edgeCollection(collectionName);
return collection.save(data, fromId, toId);
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:26,代码来源:graph.ts
示例10: removeVertexCollection
/**
* Removes the vertex collection with the given collectionName from the graph.
*
* @param {string} collectionName Name of the vertex collection to remove from the graph.
* @param {boolean} dropCollection If set to true, the collection will
* also be deleted from the database.
* @return {Object } removed vertex
*/
async removeVertexCollection(collectionName: string, dropCollection?: boolean):
Promise<any> {
if (_.isNil(collectionName)) {
throw new Error('missing vertex collection name');
}
if (_.isNil(dropCollection)) {
dropCollection = false;
}
const collection = await this.graph.removeVertexCollection(collectionName,
dropCollection);
return collection;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:20,代码来源:graph.ts
注:本文中的arangojs.Graph类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论