com.baidu.hugegraph.backend.query.Query.page()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中com.baidu.hugegraph.backend.query.Query.page方法的一些代码示例,展示了Query.page的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.page方法的具体详情如下:
包路径:com.baidu.hugegraph.backend.query.Query
类名称:Query
方法名:page

Query.page介绍

暂无

代码示例

代码示例来源:origin: hugegraph/hugegraph

public default void setPage(String page) {
  this.queryInfo().page(page);
}

代码示例来源:origin: hugegraph/hugegraph

protected void wrapPage(StringBuilder select, Query query) {
  String page = query.page();
  // It's the first time if page is empty
  if (!page.isEmpty()) {
    PageState pageState = PageState.fromString(page);
    Map<HugeKeys, Object> columns = pageState.columns();
    List<HugeKeys> idColumnNames = this.idColumnName();
    List<Object> values = new ArrayList<>(idColumnNames.size());
    for (HugeKeys key : idColumnNames) {
      values.add(columns.get(key));
    }
    // Need add `where` to `select` when query is IdQuery
    boolean startWithWhere = query.conditions().isEmpty();
    WhereBuilder where = new WhereBuilder(startWithWhere);
    where.gte(formatKeys(idColumnNames), values);
    select.append(where.build());
  }
  assert query.limit() != Query.NO_LIMIT;
  // Fetch `limit + 1` records for judging whether reached the last page
  select.append(" limit ");
  select.append(query.limit() + 1);
  select.append(";");
}

代码示例来源:origin: hugegraph/hugegraph

public BinaryEntryIterator(BackendIterator<Elem> results, Query query,
              BiFunction<BackendEntry, Elem, BackendEntry> m) {
  super(query);
  E.checkNotNull(results, "results");
  E.checkNotNull(m, "merger");
  this.results = results;
  this.merger = m;
  this.next = null;
  this.skipOffset();
  if (query.paging()) {
    this.skipPageOffset(query.page());
  }
}

代码示例来源:origin: hugegraph/hugegraph

public default <Q extends Query> Q injectQueryInfo(Q query) {
    query.orders(this.queryInfo().orders());
    query.offset(this.queryInfo().offset());
    query.limit(this.queryInfo().limit());
    query.page(this.queryInfo().page());
    query.capacity(this.queryInfo().capacity());
    return query;
  }
}

代码示例来源:origin: hugegraph/hugegraph

protected RowIterator queryAll(Session session, Query query) {
  if (query.paging()) {
    PageState page = PageState.fromString(query.page());
    byte[] begin = page.position();
    return session.scan(this.table(), begin, null);
  } else {
    return session.scan(this.table(), -1);
  }
}

代码示例来源:origin: hugegraph/hugegraph

protected BackendColumnIterator queryAll(Session session, Query query) {
  if (query.paging()) {
    PageState page = PageState.fromString(query.page());
    byte[] begin = page.position();
    return session.scan(this.table(), begin, null, Session.SCAN_ANY);
  } else {
    return session.scan(this.table());
  }
}

代码示例来源:origin: hugegraph/hugegraph

String page = query.page();
if (page == null) {
  select.limit((int) total);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

public default void setPage(String page) {
  this.queryInfo().page(page);
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-mysql

protected void wrapPage(StringBuilder select, Query query) {
  String page = query.page();
  // It's the first time if page is empty
  if (!page.isEmpty()) {
    PageState pageState = PageState.fromString(page);
    Map<HugeKeys, Object> columns = pageState.columns();
    List<HugeKeys> idColumnNames = this.idColumnName();
    List<Object> values = new ArrayList<>(idColumnNames.size());
    for (HugeKeys key : idColumnNames) {
      values.add(columns.get(key));
    }
    // Need add `where` to `select` when query is IdQuery
    boolean startWithWhere = query.conditions().isEmpty();
    WhereBuilder where = new WhereBuilder(startWithWhere);
    where.gte(formatKeys(idColumnNames), values);
    select.append(where.build());
  }
  assert query.limit() != Query.NO_LIMIT;
  // Fetch `limit + 1` records for judging whether reached the last page
  select.append(" limit ");
  select.append(query.limit() + 1);
  select.append(";");
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

public BinaryEntryIterator(BackendIterator<Elem> results, Query query,
              BiFunction<BackendEntry, Elem, BackendEntry> m) {
  super(query);
  E.checkNotNull(results, "results");
  E.checkNotNull(m, "merger");
  this.results = results;
  this.merger = m;
  this.next = null;
  this.skipOffset();
  if (query.paging()) {
    this.skipPageOffset(query.page());
  }
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

public default <Q extends Query> Q injectQueryInfo(Q query) {
    query.orders(this.queryInfo().orders());
    query.offset(this.queryInfo().offset());
    query.limit(this.queryInfo().limit());
    query.page(this.queryInfo().page());
    query.capacity(this.queryInfo().capacity());
    return query;
  }
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-cassandra

String page = query.page();
if (page == null) {
  select.limit((int) total);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-rocksdb

protected BackendColumnIterator queryAll(Session session, Query query) {
  if (query.paging()) {
    PageState page = PageState.fromString(query.page());
    byte[] begin = page.position();
    return session.scan(this.table(), begin, null, Session.SCAN_ANY);
  } else {
    return session.scan(this.table());
  }
}

相关文章