bootiful-sqltemplate-core/src/main/java/ninja/cero/sqltemplate/core/SqlTemplate.java
public <T, U> U forStream(
            String fileName,
            Class<T> clazz,
            Map<String, Object> params,
            Function<? super Stream<T>, U> handleStream) {
        String sql = getTemplate(fileName, params);
        SqlParameterSource sps = paramBuilder.byMap(params);
        RowMapper<T> mapper = mapperBuilder.mapper(clazz);
        return queryStreamWithNamedParams(sql, sps, mapper, handleStream);
    }
public <T, U> U forStream(
            String fileName,
            Class<T> clazz,
            Map<String, Object> params,
            Function<? super Stream<T>, U> handleStream) {
        String sql = getTemplate(fileName, params);
        SqlParameterSource sps = paramBuilder.byMap(params);
        RowMapper<T> mapper = mapperBuilder.mapper(clazz);
        return queryStreamWithNamedParams(sql, sps, mapper, handleStream);
    }
Executes a query using {@code params} as the named parameters,
passing the row objects to {@code handleStream} as a stream.

<p>Example usage:</p>

<pre>
Map&lt;String, Object&gt; params = new HashMap&gt;&lt;();
params.put("deptno", 30);
params.put("job", "SALESMAN");
int totalSalary = sqlTemplate.forStream("/path/to/query.sql", Emp.class, params,
empStream -&gt; empStream.mapToInt(Emp::getSalary).sum());
</pre>

@param fileName parameterized SQL specifier
@param clazz the result object class
@param params the named parameters
@param handleStream  the function which is applied to the stream
@param <T> the row object type
@param <U> the result type
@return the result of {@code handleStream}
@throws org.springframework.dao.DataAccessException if there is any problem