Java 类org.jooq.Param 实例源码

项目:httpQL    文件:ParsedQueryTest.java   
@Test
public void itWorksWithConditionProvider() {
  query.put("count__gt", "100");

  ParsedQuery<Spec> parsed = parser.parse(query);
  BoundFilterEntry<Spec> bfe = parsed.getBoundFilterEntries().get(0);
  ConditionProvider<?> provider = bfe.getConditionProvider(fieldFactory);

  provider = bfe.getConditionProvider(fieldFactory);
  Param<?> value = provider.getParam(parsed.getBoundQuery().getCount(), "count");

  assertThat(provider.getField().getName()).isEqualTo("count");
  assertThat(provider.getField().getType()).isEqualTo(Long.class);
  assertThat(value.getValue()).isEqualTo(100L);

}
项目:keywhiz    文件:ClientDAO.java   
public void sawClient(Client client) {
  Instant now = Instant.now();
  Instant lastSeen = Optional.ofNullable(client.getLastSeen()).map(ls -> Instant.ofEpochSecond(ls.toEpochSecond())).orElse(null);

  // only update last seen if it's been more than `lastSeenThreshold` seconds
  // this way we can have less granularity on lastSeen and save db writes
  if (lastSeen == null || now.isAfter(lastSeen.plus(lastSeenThreshold, SECONDS))) {
    dslContext.transaction(configuration -> {
      Param<Long> val = DSL.val(now.getEpochSecond(), CLIENTS.LASTSEEN);
      DSL.using(configuration)
          .update(CLIENTS)
          .set(CLIENTS.LASTSEEN, DSL.when(CLIENTS.LASTSEEN.isNull(), val).otherwise(DSL.greatest(CLIENTS.LASTSEEN, val)))
          .where(CLIENTS.ID.eq(client.getId()))
          .execute();
    });
  }
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
private JsonArray getBindValues(Query query) {
    JsonArray bindValues = new JsonArray();
    for (Param<?> param : query.getParams().values()) {
        Object value = convertToDatabaseType(param);
        if(value==null){
            bindValues.addNull();
        }else{
            bindValues.add(value);
        }
    }
    return bindValues;
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
private JsonArray getBindValues(Query query) {
    JsonArray bindValues = new JsonArray();
    for (Param<?> param : query.getParams().values()) {
        Object value = convertToDatabaseType(param);
        if(value==null){
            bindValues.addNull();
        }else{
            bindValues.add(value);
        }
    }
    return bindValues;
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
private JsonArray getBindValues(Query query) {
    JsonArray bindValues = new JsonArray();
    for (Param<?> param : query.getParams().values()) {
        Object value = convertToDatabaseType(param);
        if(value==null){
            bindValues.addNull();
        }else{
            bindValues.add(value);
        }
    }
    return bindValues;
}
项目:httpQL    文件:Contains.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.contains(value);
    }

  };
}
项目:httpQL    文件:LessThan.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.lt(value);
    }

  };
}
项目:httpQL    文件:Null.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.isNull();
    }
  };
}
项目:httpQL    文件:Equal.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.eq(value);
    }

  };
}
项目:httpQL    文件:GreaterThanOrEqual.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.greaterOrEqual(value);
    }

  };
}
项目:httpQL    文件:InsensitiveContains.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      String originalValue = (String) value.getValue();
      String escapedValue = ESCAPER.escape(originalValue);
      return field.likeIgnoreCase('%' + escapedValue + '%', '!');
    }

  };
}
项目:httpQL    文件:NotEqual.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.isNull().or(field.notEqual(value));
    }

  };
}
项目:httpQL    文件:LessThanOrEqual.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.lessOrEqual(value);
    }

  };
}
项目:httpQL    文件:StartsWith.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.startsWith(value);
    }

  };
}
项目:httpQL    文件:NotNull.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.isNotNull();
    }
  };
}
项目:httpQL    文件:GreaterThan.java   
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
  return new ConditionProvider<T>(field) {

    @Override
    public Condition getCondition(Param<T> value) {
      return field.gt(value);
    }

  };
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
static <T> Object convertToDatabaseType(Param<T> param) {
    return param.getBinding().converter().to(param.getValue());
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
static <T> Object convertToDatabaseType(Param<T> param) {
    return param.getBinding().converter().to(param.getValue());
}
项目:vertx-jooq-async    文件:AsyncJooqSQLClientImpl.java   
static <T> Object convertToDatabaseType(Param<T> param) {
    return param.getBinding().converter().to(param.getValue());
}
项目:httpQL    文件:MultiParamConditionProvider.java   
@Override
public Condition getCondition(Param<T> value) {
  throw new RuntimeException("Single-value getCondition() called for multi-value filter!");
}
项目:httpQL    文件:ConditionProvider.java   
public Param<T> getParam(Object value, String paramName) {
  Param<T> param = DSL.param(paramName, field.getType());
  param.setConverted(value);
  return param;
}
项目:httpQL    文件:ConditionProvider.java   
public abstract Condition getCondition(Param<T> value);