Closed lukashermansson closed 6 months ago
Thanks for putting so much thought into this. I have indeed mixed feelings about this. On the one hand this might be sth that is useful to many people. On the other hand I think this is a bit out of scope for this crate.
So yes, an example of how to do this would be highly appreciated.
This pull request is an attempt to make something like this work:
note that the Uuid here is the newtype from this library to support the leptos_struct_table::TableRow derive
This adds feature flags and implementations for the required sqlx stuff for the above to work on postgres hopefully also mysql and sqlite (I have not tested these ones myself yet tho) from what i can tell these are the database providers with an imementation for these in the sqlx library.
While the above seems to work i have no idea if this pr is a good idea (does feel like it could be a slippery slope to begin these kinds of extentions to the newtypes this library has to provide for convenient rendering) An alternative instead of placing this responsibility within this library would be to map from an sqlx struct (with
FromRow
implemented) to a leptos_struct_table struct (with appropriate newtypes instead of theuuid::Uuid
type) feel free to close this pr if this is more of the direction you want this library to go. (if that is the case i would be happy to try to provide a pr with documentation (or extend the sqlx example with information on how to map a uuid type that works withsqlx::FromRow
to a type that works with theleptos_struct_table::TableRow
derive)