本文整理了Java中org.jooq.Field.getValue()
方法的一些代码示例,展示了Field.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.getValue()
方法的具体详情如下:
包路径:org.jooq.Field
类名称:Field
方法名:getValue
[英]The inverse operation of Record#getValue(Field).
This method can be used in its method reference form conveniently on a generated table, for instance, when mapping records in a stream: ``
DSL.using(configuration)
.fetch("select * from t")
.stream()
.map(MY_TABLE.ID::getValue)
.forEach(System.out::println);
[中]记录#getValue(字段)的逆运算。
此方法可以方便地在生成的表上以其方法引用形式使用,例如,当映射流中的记录时:``
DSL.using(configuration)
.fetch("select * from t")
.stream()
.map(MY_TABLE.ID::getValue)
.forEach(System.out::println);
代码示例来源:origin: jklingsporn/vertx-jooq-async
@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));
}
代码示例来源:origin: jklingsporn/vertx-jooq
@SuppressWarnings("unchecked")
@Override
public EXECUTE update(P object){
Objects.requireNonNull(object);
return queryExecutor().execute(dslContext -> {
R record = dslContext.newRecord(getTable(), object);
Condition where = DSL.trueCondition();
UniqueKey<R> pk = getTable().getPrimaryKey();
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 dslContext
.update(getTable())
.set(valuesToUpdate)
.where(where);
});
}
代码示例来源:origin: io.github.jklingsporn/vertx-jooq-shared
@SuppressWarnings("unchecked")
@Override
public EXECUTE update(P object){
Objects.requireNonNull(object);
return queryExecutor().execute(dslContext -> {
R record = dslContext.newRecord(getTable(), object);
Condition where = DSL.trueCondition();
UniqueKey<R> pk = getTable().getPrimaryKey();
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 dslContext
.update(getTable())
.set(valuesToUpdate)
.where(where);
});
}
内容来源于网络,如有侵权,请联系作者删除!