docs: Mention example of binary-like newtype#177
Conversation
7cf9b45 to
4b2e88f
Compare
| res: &sea_orm::QueryResult, | ||
| index: I, | ||
| ) -> Result<Self, sea_orm::error::TryGetError> { | ||
| let val = <Vec<u8> as sea_orm::TryGetable>::try_get_by(res, index)?; |
There was a problem hiding this comment.
I think this can be reduced further to a minimal example: When implementing TryGetable manually, <T as TryGetable>::try_get_by should be used instead of QueryResult::try_get_by. They have the same name, but they are very different methods.
There was a problem hiding this comment.
I'm sorry i'm not sure i follow. Isn't that precisely what's in the example here? (i followed your previous suggestions but i don't understand the difference with this one)
There was a problem hiding this comment.
I think the other examples already provide sufficient context. The focus here is on ensuring users don't accidentally use QueryResult::try_get_by, and previous examples have clearly illustrated this with syntax like <T as sea_orm::TryGetable>.
Therefore, I think this section could be made more concise by removing unnecessary example code. In short, it should focus more on explaining the core principles rather than adding more examples.
Following discussion in SeaQL/sea-orm#3062
Explain how to use a binary type as a column.