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

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

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

Field.lessThan介绍

[英]this < value.
[中]this < value.

代码示例

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

private Select<? extends Record> getAllTimestampsQueryAllColumns(DSLContext ctx,
                                 TableReference tableRef,
                                 Select<Record1<byte[]>> subQuery,
                                 long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_TIMESTAMP.lessThan(timestamp)));
}

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

@Override
public Multimap<Cell, Long> getAllTimestamps(final TableReference tableRef,
                       final Set<Cell> cells,
                       final long timestamp) throws InsufficientConsistencyException {
  if (cells.isEmpty()) {
    return ImmutableMultimap.of();
  }
  Multimap<Cell, Long> toReturn = ArrayListMultimap.create();
  for (List<Cell> partition : Iterables.partition(cells, batchSizeForReads)) {
    toReturn.putAll(run(ctx -> {
      Result<? extends Record> records = ctx
          .select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
          .from(atlasTable(tableRef).as(ATLAS_TABLE))
          .join(values(ctx, toRows(Sets.newHashSet(partition)), TEMP_TABLE_1, ROW_NAME, COL_NAME))
          .on(A_ROW_NAME.eq(T1_ROW_NAME)
              .and(A_COL_NAME.eq(T1_COL_NAME)))
          .where(A_TIMESTAMP.lessThan(timestamp))
          .fetch();
      Multimap<Cell, Long> results = ArrayListMultimap.create(records.size() / 4, 4);
      for (Record record : records) {
        results.put(
            Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
            record.getValue(A_TIMESTAMP));
      }
      return results;
    }));
  }
  return toReturn;
}

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

private Select<? extends Record> getAllTimestampsQuerySomeColumns(DSLContext ctx,
                                 TableReference tableRef,
                                 Select<Record1<byte[]>> subQuery,
                                 Collection<byte[]> cols,
                                 long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp));
}

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

private Select<? extends Record> getLatestTimestampQueryAllColumns(DSLContext ctx,
                                  TableReference tableRef,
                                  Collection<byte[]> rows,
                                  long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(rows)
          .and(A_TIMESTAMP.lessThan(timestamp)))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}

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

private Select<? extends Record> getLatestTimestampQueryAllColumnsSubQuery(DSLContext ctx,
                                      TableReference tableRef,
                                      Select<Record1<byte[]>> subQuery,
                                      long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_TIMESTAMP.lessThan(timestamp)))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}

代码示例来源: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: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQuerySomeColumns(DSLContext ctx,
                                  TableReference tableRef,
                                  Collection<byte[]> rows,
                                  Collection<byte[]> cols,
                                  long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(rows)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}

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

private Select<? extends Record> getLatestTimestampQuerySomeColumnsSubQuery(DSLContext ctx,
                                      TableReference tableRef,
                                      Select<Record1<byte[]>> subQuery,
                                      Collection<byte[]> cols,
                                      long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}

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

private Select<? extends Record> getLatestTimestampQueryManyTimestamps(DSLContext ctx,
                                    TableReference tableRef,
                                    RowN[] rows) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .join(values(ctx, rows, TEMP_TABLE_1, ROW_NAME, COL_NAME, TIMESTAMP))
      .on(A_ROW_NAME.eq(T1_ROW_NAME)
          .and(A_COL_NAME.eq(T1_COL_NAME)))
      .where(A_TIMESTAMP.lessThan(T1_TIMESTAMP))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}

代码示例来源: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.greaterOrEqual(convertToSqlDate(value.toString()));
case ("lt"):
  return field.lessThan(convertToSqlDate(value.toString()));
case ("lte"):
  return field.lessOrEqual(convertToSqlDate(value.toString()));

代码示例来源: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

return DSL
  .when(argument.sub(DSL.floor(argument))
  .lessThan((T) Double.valueOf(0.5)), DSL.floor(argument))
  .otherwise(DSL.ceil(argument));
  .lessThan((T) Double.valueOf(0.5)), DSL.floor(mul).div(factor))
  .otherwise(DSL.ceil(mul).div(factor));

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

.when(first.lessThan(other), DSL.least(first, remaining))
.otherwise(DSL.least(other, remaining));
.when(first.lessThan(other), first)
.otherwise(other);

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

return DSL.decode()
  .when(argument.sub(DSL.floor(argument))
  .lessThan((T) Double.valueOf(0.5)), DSL.floor(argument))
  .otherwise(DSL.ceil(argument));
  .lessThan((T) Double.valueOf(0.5)), DSL.floor(mul).div(factor))
  .otherwise(DSL.ceil(mul).div(factor));

代码示例来源: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.lessThan(other), DSL.least(first, remaining))
.otherwise(DSL.least(other, remaining));
.when(first.lessThan(other), first)
.otherwise(other);

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

@Override
public Condition visit(IsLessQueryCriteria 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.lessThan(value);
  if (typeCondition != null) {
    criteriaCondition = typeCondition.and(criteriaCondition);
  }
  return addArrayCondition(criteria, criteriaCondition, keys, inArray);
}

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

public List<ProcessEntry> poll(PollEntry entry, Field<Timestamp> maxAge, int maxEntries) {
  ProcessQueue q = PROCESS_QUEUE.as("q");
  return txResult(tx -> tx.select(q.INSTANCE_ID, q.CREATED_AT, q.PROJECT_ID, q.INITIATOR_ID)
      .from(q)
      .where(q.PROCESS_KIND.in(Utils.toString(HANDLED_PROCESS_KINDS))
          .and(q.CURRENT_STATUS.eq(entry.status.toString()))
          .and(q.CREATED_AT.greaterOrEqual(maxAge))
          .and(PgUtils.contains(q.HANDLERS, new String[]{entry.flow}))
          .and(noSuccessfulHandlers(q.INSTANCE_ID, entry.handlerKind))
          .and(count(tx, q.INSTANCE_ID, entry.handlerKind).lessThan(entry.maxTries))
          .and(noRunningHandlers(q.INSTANCE_ID)))
      .limit(maxEntries)
      .fetch(WatchdogDao::toEntry));
}

相关文章