turso-mappers
Row mappers for turso
See the published crate and the documentation for more information.
- Allows you to map turso rows to structs more easily
- Provides a
MapRowstrait with amap_rowsmethod for easily mapping overturso::Rows - Defines a
TryFromRowtrait forturso::Row - Supports deriving the
TryFromRowtraits for structs via the turso-mappers-derive crate - Currently requires the columns in the SQL query to be in the same order as the struct fields
- Currently maps by index in the TryFromRow implementation
- Currently only supports i64 and String types in the derive macro
Usage
This is a work in progress. Currently, the following functionality is implemented.
map_rowsfromMapRowsis implemented to allow mapping over rows- The
TryFromRowderive macro is implemented (as a proof of concept, for simple cases only)
use MapRows;
use TryFromRow;
use TursoMapperResult;
use TursoMapperError;
use Text;
use Row;
use Builder;
async
TODO
- Add support for Option types to handle null values
- Add support for more data types (currently only i64 and String are supported)
- Add an option to use named mapping (by column name) instead of index-based mapping
- Improve error messages and error handling