当前位置: 首页>>代码示例>>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;未经允许,请勿转载。