• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript arangojs.Graph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript archiver.create函数代码示例发布时间:2022-05-25
下一篇:
TypeScript arangojs.Database类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap