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


Java HashIndexOptions類代碼示例

本文整理匯總了Java中com.arangodb.model.HashIndexOptions的典型用法代碼示例。如果您正苦於以下問題:Java HashIndexOptions類的具體用法?Java HashIndexOptions怎麽用?Java HashIndexOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HashIndexOptions類屬於com.arangodb.model包,在下文中一共展示了HashIndexOptions類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: FormRepositoryArangoImpl

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
public FormRepositoryArangoImpl() {
    arangoDB = new ArangoDB.Builder()
            .host(config.getHost(), config.getPort())
            .user(config.getUser())
            .password(config.getPassword())
            .registerModule(new VPackJdk8Module())
            .build();
    // if first time connect to the arango, create menu database.
    if(!arangoDB.getDatabases().contains(config.getFormDBName())) {
        arangoDB.createDatabase(config.getFormDBName());
        db = arangoDB.db(config.getFormDBName());
        // add form collection with unique indexes
        CollectionEntity formCollection = db.createCollection(FORM);
        final Collection<String> fields = new ArrayList<String>();
        fields.add(ID);
        HashIndexOptions options = new HashIndexOptions();
        options.unique(true);
        db.collection(FORM).createHashIndex(fields, options);
    }
    if(db == null) db = arangoDB.db(config.getFormDBName());
}
 
開發者ID:networknt,項目名稱:light-portal,代碼行數:22,代碼來源:FormRepositoryArangoImpl.java

示例2: createHashIndexRequest

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
protected Request createHashIndexRequest(final Iterable<String> fields, final HashIndexOptions options) {
	final Request request;
	request = new Request(db.name(), RequestType.POST, ArangoDBConstants.PATH_API_INDEX);
	request.putQueryParam(ArangoDBConstants.COLLECTION, name);
	request.setBody(
		util().serialize(OptionsBuilder.build(options != null ? options : new HashIndexOptions(), fields)));
	return request;
}
 
開發者ID:arangodb,項目名稱:arangodb-java-driver,代碼行數:9,代碼來源:InternalArangoCollection.java

示例3: MenuRepositoryArangoImpl

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
public MenuRepositoryArangoImpl() {
    arangoDB = new ArangoDB.Builder()
            .host(config.getHost(), config.getPort())
            .user(config.getUser())
            .password(config.getPassword())
            .registerModule(new VPackJdk8Module())
            .build();
    // if first time connect to the arango, create menu database.
    if(!arangoDB.getDatabases().contains(config.getMenuDBName())) {
        arangoDB.createDatabase(config.getMenuDBName());
        db = arangoDB.db(config.getMenuDBName());
        // add two collections with unique indexes
        CollectionEntity menuCollection = db.createCollection(MENU);
        final Collection<String> fields = new ArrayList<String>();
        fields.add(ENTITYID);
        HashIndexOptions options = new HashIndexOptions();
        options.unique(true);
        db.collection(MENU).createHashIndex(fields, options);

        CollectionEntity menuItemCollection = db.createCollection(MENUITEM);
        db.collection(MENUITEM).createHashIndex(fields, options);

        // add graph
        Collection<EdgeDefinition> edgeDefinitions = new ArrayList<>();
        EdgeDefinition edgeDefinition = new EdgeDefinition();
        edgeDefinition.collection(CONTAINS);
        edgeDefinition.from(MENU, MENUITEM);
        edgeDefinition.to(MENUITEM);
        edgeDefinitions.add(edgeDefinition);
        db.createGraph(CONTAINSGRAPH, edgeDefinitions);

        // create a function
        db.createAqlFunction("LIGHTAPI::COMMON::AGGREGATE_PATH",
                "function (flat) {\n" +
                        "        var result = flat[0][0];\n" +
                        "        if (flat) {\n" +
                        "            flat.forEach(function (path) {\n" +
                        "                for(var i = path.length -1; i > 0; i--) {\n" +
                        "                    path[i-1].contains = new Array();\n" +
                        "                    path[i-1].contains.push(path[i]);\n" +
                        "                }\n" +
                        "            });\n" +
                        "        }\n" +
                        "        function includes(a, o) {\n" +
                        "            var found;\n" +
                        "            a.forEach(function (e) {\n" +
                        "                if(e._key === o._key) {\n" +
                        "                    found = e;\n" +
                        "                }\n" +
                        "            });\n" +
                        "            return found;\n" +
                        "        }\n" +
                        "        function mergeObjects(target, source) {\n" +
                        "            if(target && target.contains) {\n" +
                        "                if(source.contains) {\n" +
                        "                    source.contains.forEach(function(v) {\n" +
                        "                        var e = includes(target.contains, v);\n" +
                        "                        if(!e) {\n" +
                        "                            target.contains.push(v);\n" +
                        "                        } else {\n" +
                        "                            mergeObjects(e, v);\n" +
                        "                        }\n" +
                        "                    });\n" +
                        "                }\n" +
                        "            } else {\n" +
                        "                if(target && source.contains) {\n" +
                        "                    target.contains = source.contains;\n" +
                        "                }\n" +
                        "            }\n" +
                        "        }\n" +
                        "        for(var j= flat.length -1; j >= 0; j--) {\n" +
                        "            mergeObjects(result, flat[j][0]);\n" +
                        "        }\n" +
                        "        return result;\n" +
                        "    }\n", null);
    }
    if(db == null) db = arangoDB.db(config.getMenuDBName());
}
 
開發者ID:networknt,項目名稱:light-portal,代碼行數:79,代碼來源:MenuRepositoryArangoImpl.java

示例4: createHashIndex

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
/**
 * Creates a hash index for the collection, if it does not already exist.
 * 
 * @deprecated use {@link #ensureHashIndex(Iterable, HashIndexOptions)} instead
 * @see <a href="https://docs.arangodb.com/current/HTTP/Indexes/Hash.html#create-hash-index">API Documentation</a>
 * @param fields
 *            A list of attribute paths
 * @param options
 *            Additional options, can be null
 * @return information about the index
 */
@Deprecated
public CompletableFuture<IndexEntity> createHashIndex(
	final Collection<String> fields,
	final HashIndexOptions options) {
	return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}
 
開發者ID:arangodb,項目名稱:arangodb-java-driver-async,代碼行數:18,代碼來源:ArangoCollectionAsync.java

示例5: ensureHashIndex

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
/**
 * Creates a hash index for the collection, if it does not already exist.
 * 
 * @see <a href="https://docs.arangodb.com/current/HTTP/Indexes/Hash.html#create-hash-index">API Documentation</a>
 * @param fields
 *            A list of attribute paths
 * @param options
 *            Additional options, can be null
 * @return information about the index
 */
public CompletableFuture<IndexEntity> ensureHashIndex(
	final Iterable<String> fields,
	final HashIndexOptions options) {
	return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}
 
開發者ID:arangodb,項目名稱:arangodb-java-driver-async,代碼行數:16,代碼來源:ArangoCollectionAsync.java

示例6: createHashIndex

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
/**
 * Creates a hash index for the collection if it does not already exist.
 * 
 * @deprecated use {@link #ensureHashIndex(Iterable, HashIndexOptions)} instead
 * @see <a href="https://docs.arangodb.com/current/HTTP/Indexes/Hash.html#create-hash-index">API Documentation</a>
 * @param fields
 *            A list of attribute paths
 * @param options
 *            Additional options, can be null
 * @return information about the index
 * @throws ArangoDBException
 */
@Deprecated
public IndexEntity createHashIndex(final Collection<String> fields, final HashIndexOptions options)
		throws ArangoDBException {
	return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}
 
開發者ID:arangodb,項目名稱:arangodb-java-driver,代碼行數:18,代碼來源:ArangoCollection.java

示例7: ensureHashIndex

import com.arangodb.model.HashIndexOptions; //導入依賴的package包/類
/**
 * Creates a hash index for the collection if it does not already exist.
 * 
 * @see <a href="https://docs.arangodb.com/current/HTTP/Indexes/Hash.html#create-hash-index">API Documentation</a>
 * @param fields
 *            A list of attribute paths
 * @param options
 *            Additional options, can be null
 * @return information about the index
 * @throws ArangoDBException
 */
public IndexEntity ensureHashIndex(final Iterable<String> fields, final HashIndexOptions options)
		throws ArangoDBException {
	return executor.execute(createHashIndexRequest(fields, options), IndexEntity.class);
}
 
開發者ID:arangodb,項目名稱:arangodb-java-driver,代碼行數:16,代碼來源:ArangoCollection.java


注:本文中的com.arangodb.model.HashIndexOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。