Skip to content

docs: Mention example of binary-like newtype#177

Open
angrynode wants to merge 1 commit into
SeaQL:masterfrom
angrynode:docs-newtype-binary
Open

docs: Mention example of binary-like newtype#177
angrynode wants to merge 1 commit into
SeaQL:masterfrom
angrynode:docs-newtype-binary

Conversation

@angrynode
Copy link
Copy Markdown

Following discussion in SeaQL/sea-orm#3062

Explain how to use a binary type as a column.

Comment thread SeaORM/docs/04-generate-entity/05-newtype.md Outdated
@angrynode angrynode force-pushed the docs-newtype-binary branch from 7cf9b45 to 4b2e88f Compare May 18, 2026 12:06
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)?;
Copy link
Copy Markdown
Member

@Huliiiiii Huliiiiii May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Huliiiiii Huliiiiii requested a review from tyt2y3 May 19, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants