當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript arangojs.Graph類代碼示例

本文整理匯總了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;未經允許,請勿轉載。