[英]How to convert data into Result<Record> data type in jooq
I am working on a large project in which the functions I want to use, accept data in the form of List< Result< Record >> and then send it to frontend or convert to csv.我正在做一个大型项目,其中我想要使用的功能,以 List<Result<Record>> 的形式接受数据,然后将其发送到前端或转换为 csv。
I am receiving data in the form of List< Object > and I want to convert data from List< Object > to List< Result< Record >>.我以 List<Object> 的形式接收数据,我想将数据从 List<Object> 转换为 List<Result<Record>>。 How to do it?
怎么做?
public class Object {
int x;
string str;
float f;
}
You can create in-memory Result
values using DSLContext.newResult()
and DSLContext.newRecord()
like this:您可以使用
DSLContext.newResult()
和DSLContext.newRecord()
创建内存中的Result
值,如下所示:
Field<Integer> x = ...;
Field<String> str = ...;
Field<Float> f = ...;
Result<Record3<Integer, String, Float>> r = ctx.newResult(x, str, f);
for (Object o : list)
r.add(ctx.newRecord(x, str, f).values(o.x, o.str, o.f));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.