Open tgy3300 opened 3 months ago
Hi. In the current version from_row
consumes Row
(non-consuming API is partially implemented and planned for the next release). This means that for now your only option is to manually disassemble the row into Company and Account (using Row::take
) or to use CompanyAccount
intermediate structure.
Please be aware of the fact that FromRow
may fail or even give unexpected result if column names collide - this is the case in your example (id, status, create_at, ...)
There is a requirement: in mysql database query, single table query uses a structure, JOIN table query (JOIN) involves multiple tables, need to combine multiple single table structures together, because the single table structure has been written, so at this time only want to combine multiple structures to meet, golang, my approach is:
Pass the C structure to the associative table query on the line, but in rust, how to achieve, look at the following code: How can the CompanyAccount struct be written to fit your needs, not foolishly rewriting the Company and Account struct fields in CompanyAccount