本文整理匯總了Java中org.jooq.impl.DSL.trueCondition方法的典型用法代碼示例。如果您正苦於以下問題:Java DSL.trueCondition方法的具體用法?Java DSL.trueCondition怎麽用?Java DSL.trueCondition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jooq.impl.DSL
的用法示例。
在下文中一共展示了DSL.trueCondition方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createNTrueCondition
import org.jooq.impl.DSL; //導入方法依賴的package包/類
private static Condition createNTrueCondition(final int n) {
if (n < 1)
throw new IllegalArgumentException("Cannot have n < 1");
Condition condition = null;
for (int i = 0; i < n; i++) {
if (condition == null)
condition = DSL.trueCondition();
else
condition = condition.and(DSL.trueCondition());
}
return condition;
}
示例2: updateExecAsync
import org.jooq.impl.DSL; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static <P extends VertxPojo, R extends UpdatableRecord<R>,T,F> F updateExecAsync(P object, DAO<R,P,T> dao, Function<Query,F> function){
DSLContext dslContext = DSL.using(dao.configuration());
UniqueKey<R> pk = dao.getTable().getPrimaryKey();
R record = dslContext.newRecord(dao.getTable(), object);
Condition where = DSL.trueCondition();
for (TableField<R,?> tableField : pk.getFields()) {
//exclude primary keys from update
record.changed(tableField,false);
where = where.and(((TableField<R,Object>)tableField).eq(record.get(tableField)));
}
Map<String, Object> valuesToUpdate =
Arrays.stream(record.fields())
.collect(HashMap::new, (m, f) -> m.put(f.getName(), f.getValue(record)), HashMap::putAll);
return function.apply(dslContext.update(dao.getTable()).set(valuesToUpdate).where(where));
}