use of com.google.cloud.spanner.ResultSet in project spring-cloud-gcp by spring-cloud.
the class SpannerTemplate method query.
@Override
public <A> List<A> query(Function<Struct, A> rowFunc, Statement statement, SpannerQueryOptions options) {
ArrayList<A> result = new ArrayList<>();
try (ResultSet resultSet = executeQuery(statement, options)) {
while (resultSet.next()) {
result.add(rowFunc.apply(resultSet.getCurrentRowAsStruct()));
}
}
maybeEmitEvent(new AfterQueryEvent(result, statement, options));
return result;
}
Aggregations