示例#1
0
def create_edges_for_category_has_files(files: list, category_key: str,
                                        edge_db_collection: EdgeCollection):
    for file_name in files:
        edge_db_collection.insert({
            "_from": f"{COLLECTION_MENU_CATEGORIES}/{category_key}",
            "_to": f"{COLLECTION_FILES}/{file_name}",
        })
示例#2
0
def create_edges_for_language_has_collections(
        language: str, collection_key: str,
        edge_db_collection: EdgeCollection):
    edge_db_collection.insert({
        "_from":
        f"{COLLECTION_LANGUAGES}/{language}",
        "_to":
        f"{COLLECTION_MENU_COLLECTIONS}/{collection_key}",
    })
示例#3
0
def create_edges_for_collection_has_categories(
    language: str,
    categories: dict,
    collection_key: str,
    edge_db_collection: EdgeCollection,
) -> None:
    for category_name in categories:
        edge_db_collection.insert({
            "_from":
            f"{COLLECTION_MENU_COLLECTIONS}/{collection_key}",
            "_to":
            f"{COLLECTION_MENU_CATEGORIES}/{language}_{category_name}",
        })
示例#4
0
    def edge_collection(self, name):
        """Return the edge collection API wrapper.

        :param name: Edge collection name.
        :type name: str | unicode
        :return: Edge collection API wrapper.
        :rtype: arango.collection.EdgeCollection
        """
        return EdgeCollection(self._conn, self._executor, self._name, name)