Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced usize with u64 in PaginatorTrait #789

Merged
merged 2 commits into from
Aug 20, 2022

Conversation

liberwang1013
Copy link
Contributor

@liberwang1013 liberwang1013 commented Jun 7, 2022

PR Info

this pr replaced usize with u64 in paginated query.

Changes

  • relaced usize with u64 in trait PaginatorTrait
  • relaced usize with u64 in struct Paginator

Copy link
Member

@ikrivosheev ikrivosheev left a comment

Choose a reason for hiding this comment

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

@liberwang1013 thank you! LGTM!

@tyt2y3
Copy link
Member

tyt2y3 commented Jun 12, 2022

Thank you for the contribution. Was there an issue/ context that why you think u64 is a better choice than usize?

@liberwang1013
Copy link
Contributor Author

liberwang1013 commented Jun 13, 2022

Thank you for the contribution. Was there an issue/ context that why you think u64 is a better choice than usize?

@tyt2y3
actually the Paginator Wrapped https://docs.rs/sea-orm/0.8.0/sea_orm/entity/prelude/struct.Select.html, they have different input variable types. I hope this can be kept consistent with.

Copy link
Member

@billy1624 billy1624 left a comment

Choose a reason for hiding this comment

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

Thanks for the contributions! @liberwang1013

@billy1624
Copy link
Member

Thank you for the contribution. Was there an issue/ context that why you think u64 is a better choice than usize?

Hey @tyt2y3, the context: https://discord.com/channels/873880840487206962/900758376164757555/983627886756003891

@tyt2y3
Copy link
Member

tyt2y3 commented Jun 27, 2022

Let me think twice 🤔

@ikrivosheev
Copy link
Member

ikrivosheev commented Jun 30, 2022

@tyt2y3, I review PR: #768 (comment) and here we use: usize. My point is: in pub struct ItemsAndPagesNumber we use usize and here it makes more sense to use usize

@ikrivosheev
Copy link
Member

But on the other hand, usize is depends on platform...

@tyt2y3
Copy link
Member

tyt2y3 commented Jul 1, 2022

Ah. Actually if we decided on that we can change all usize to u64, or the other way around.
Either way it will create a pile of compilation errors.
So I am quite hesitant.

@ikrivosheev
Copy link
Member

@tyt2y3, @billy1624 prepared PR for the update sqlx, I think that changing the type is not such a terrible change.

Copy link
Member

@billy1624 billy1624 left a comment

Choose a reason for hiding this comment

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

I think the changes align SeaORM's pagination utility with SeaQuery statement. Because SeaQuery's limit & offset methods both take an u64.

Although it's a breaking change to SeaORM API - changing usize to u64 - but it should be alright since it's a expansion in value range.

@tyt2y3
Copy link
Member

tyt2y3 commented Aug 20, 2022

Thank you all for your input

@tyt2y3 tyt2y3 merged commit fff0c87 into SeaQL:master Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants