org.jooq.Field.greaterThan()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(104)

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

Field.greaterThan介绍

[英]this > value.
[中]this > value.

代码示例

代码示例来源:origin: palantir/atlasdb

private SelectOffsetStep<Record1<byte[]>> getRangeQuery(DSLContext ctx,
                            TableReference tableRef,
                            RangeRequest rangeRequest,
                            long timestamp,
                            int maxRows) {
  boolean reverse = rangeRequest.isReverse();
  byte[] start = rangeRequest.getStartInclusive();
  byte[] end = rangeRequest.getEndExclusive();
  Condition cond = R_TIMESTAMP.lessThan(timestamp);
  if (start.length > 0) {
    cond = cond.and(reverse ? R_ROW_NAME.lessOrEqual(start) : R_ROW_NAME.greaterOrEqual(start));
  }
  if (end.length > 0) {
    cond = cond.and(reverse ? R_ROW_NAME.greaterThan(end) : R_ROW_NAME.lessThan(end));
  }
  return ctx.selectDistinct(R_ROW_NAME)
      .from(atlasTable(tableRef).as(RANGE_TABLE))
      .where(cond)
      .orderBy(reverse ? R_ROW_NAME.desc() : R_ROW_NAME.asc())
      .limit(maxRows);
}

代码示例来源:origin: unipop-graph/unipop

private Condition getCompareCondition(Object value, BiPredicate<?, ?> biPredicate, Field<Object> field) {
  String predicateString = biPredicate.toString();
  switch (predicateString) {
    case ("eq"):
      return field.eq(value);
    case ("neq"):
      return field.notEqual(value);
    case ("gt"):
      return field.greaterThan(value);
    case ("gte"):
      return field.greaterOrEqual(value);
    case ("lt"):
      return field.lessThan(value);
    case ("lte"):
      return field.lessOrEqual(value);
    case ("inside"):
      List items = (List) value;
      Object firstItem = items.get(0);
      Object secondItem = items.get(1);
      return field.between(firstItem, secondItem);
    default:
      throw new IllegalArgumentException("predicate not supported in has step: " + biPredicate.toString());
  }
}

代码示例来源:origin: unipop-graph/unipop

return field.notEqual(convertToSqlDate(value.toString()));
case ("gt"):
  return field.greaterThan(convertToSqlDate(value.toString()));
case ("gte"):
  return field.greaterOrEqual(convertToSqlDate(value.toString()));

代码示例来源:origin: com.walmartlabs.concord.server/concord-server

private int[] update(DSLContext tx, Connection conn, List<HostItem> hosts) throws SQLException {
  Field<Integer> currentStatusWeight = decodeStatus(choose(ANSIBLE_HOSTS.STATUS));
  Field<Integer> newStatusWeight = decodeStatus(choose(value((String) null)));
  String update = tx.update(ANSIBLE_HOSTS)
      .set(ANSIBLE_HOSTS.DURATION, ANSIBLE_HOSTS.DURATION.plus(value((Integer) null)))
      .set(ANSIBLE_HOSTS.STATUS, when(currentStatusWeight.greaterThan(newStatusWeight), ANSIBLE_HOSTS.STATUS).otherwise(value((String) null)))
      .set(ANSIBLE_HOSTS.EVENT_SEQ, when(currentStatusWeight.greaterThan(newStatusWeight), ANSIBLE_HOSTS.EVENT_SEQ).otherwise(value((Long) null)))
      .where(ANSIBLE_HOSTS.INSTANCE_ID.eq(value((UUID) null))
          .and(ANSIBLE_HOSTS.INSTANCE_CREATED_AT.eq(value((Timestamp) null))
              .and(ANSIBLE_HOSTS.HOST.eq(value((String) null))
                  .and(ANSIBLE_HOSTS.HOST_GROUP.eq(value((String) null))))))
      .getSQL();
  try (PreparedStatement ps = conn.prepareStatement(update)) {
    for (HostItem h : hosts) {
      ps.setLong(1, h.duration());
      ps.setString(2, h.status());
      ps.setString(3, h.status());
      ps.setString(4, h.status());
      ps.setLong(5, h.eventSeq());
      ps.setObject(6, h.key().instanceId());
      ps.setTimestamp(7, h.key().instanceCreatedAt());
      ps.setString(8, h.key().host());
      ps.setString(9, h.key().hostGroup());
      ps.addBatch();
    }
    return ps.executeBatch();
  }
}

代码示例来源:origin: org.jooq/jooq

@SuppressWarnings("unchecked")
  @Override
  final Field<Integer> getFunction0(Configuration configuration) {
    switch (configuration.dialect()) {



      case SQLITE:
        return DSL
          .when(((Field<Integer>) argument).greaterThan(zero()), one())
          .when(((Field<Integer>) argument).lessThan(zero()), one().neg())
          .otherwise(zero());

      default:
        return function("sign", getDataType(), argument);
    }
  }
}

代码示例来源:origin: org.jooq/jooq

.when(first.greaterThan(other), DSL.greatest(first, remaining))
.otherwise(DSL.greatest(other, remaining));
.when(first.greaterThan(other), first)
.otherwise(other);

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@SuppressWarnings("unchecked")
  @Override
  final Field<Integer> getFunction0(Configuration configuration) {
    switch (configuration.dialect()) {
      /* [pro] xx
      xxxx xxxxxxx
        xxxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxx
      xx [/pro] */

      case SQLITE:
        return DSL.decode()
          .when(((Field<Integer>) argument).greaterThan(zero()), one())
          .when(((Field<Integer>) argument).lessThan(zero()), one().neg())
          .otherwise(zero());

      default:
        return function("sign", getDataType(), argument);
    }
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

.when(first.greaterThan(other), DSL.greatest(first, remaining))
.otherwise(DSL.greatest(other, remaining));
.when(first.greaterThan(other), first)
.otherwise(other);

代码示例来源:origin: com.torodb.torod.backends/common

@Override
public Condition visit(IsGreaterQueryCriteria criteria, Boolean inArray) {
  String[] keys = translateArrayRef(criteria);
  Field field = DSL.field(databaseInterface.arraySerializer().getFieldName(keys));
  Param<?> value;
  Condition typeCondition = null;
  if (!isInArrayValue(criteria.getAttributeReference(), inArray)) {
    value = translateValueToSQL(criteria.getValue());
  }
  else {
    value = translateValueToArraySerialization(criteria.getValue());
    typeCondition = databaseInterface.arraySerializer().typeof(
        field.getName(),
        getJsonType(criteria.getValue().getType())
    );
  }
  Condition criteriaCondition = field.greaterThan(value);
  if (typeCondition != null) {
    criteriaCondition = typeCondition.and(criteriaCondition);
  }
  return addArrayCondition(criteria, criteriaCondition, keys, inArray);
}

代码示例来源:origin: bwajtr/java-persistence-frameworks-comparison

.from(project_info)
.join(project_cost).using(project_info.field("project_pid"))
.where(total_cost.greaterThan(new BigDecimal(totalCostBoundary)))
.groupBy(project_name, total_cost, company_name)
.orderBy(company_name);

相关文章