com.bixuebihui.r2dbc.sql.RowMapperResultReader Maven / Gradle / Ivy
The newest version!
package com.bixuebihui.r2dbc.sql;
import io.r2dbc.spi.Result;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import jakarta.validation.constraints.NotNull;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* RowMapperResultReader class.
*
* @author xingwx
* @version $Id: $Id
*/
public class RowMapperResultReader {
private RowMapper handle;
/**
* Constructor for RowMapperResultReader.
*
* @param handle a {@link RowMapper} object.
*/
public RowMapperResultReader(RowMapper handle){
this.handle = handle;
}
/**
* processResultSet.
*
* @param rs a {@link ResultSet} object.
* @return a {@link List} object.
*/
public @NotNull Mono> processResult(Result rs) {
return Mono.from(Flux.from(rs.map((row, meta) -> handle.mapRow(row))).collectList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy