It would be great to have a convenient way to retrieve the data as pojos from Spanner database.
For example com.google.cloud.spanner.ReadContext interface could be expanded with such methods for this purpose:
<T> T readRow(String table, StructMapper<T> mapper, Key key, Iterable<String> columns);
<T> List<T> read(String table, StructMapper<T> mapper, KeySet keys, Iterable<String> columns, ReadOption... options);
Where StructMapper is an interface that can be implemented by users for custom pojos. Also it is a reason to create default implementation that covers conversion for common types, as example org.springframework.jdbc.core.BeanPropertyRowMapper.
If you're ok with that I would be pleasant to make pull request.
It would be great to have a convenient way to retrieve the data as pojos from Spanner database.
For example
com.google.cloud.spanner.ReadContextinterface could be expanded with such methods for this purpose:Where
StructMapperis an interface that can be implemented by users for custom pojos. Also it is a reason to create default implementation that covers conversion for common types, as exampleorg.springframework.jdbc.core.BeanPropertyRowMapper.If you're ok with that I would be pleasant to make pull request.