-
-
Notifications
You must be signed in to change notification settings - Fork 299
Added mapping for xid
#2003
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
Added mapping for xid
#2003
Conversation
|
@YohDeadfall I think this looks good, outside of the one minor change. I think #2014 is going to force a pgrx v0.14.0, so now is a great time to go ahead and get this finished and committed. |
| } | ||
|
|
||
| #[inline] | ||
| pub const fn to_u32(self) -> u32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really fine? I would like to avoid any further name bikeshading as it's a little disaster even if another method added and this marked as deprecated. Shouldn't it be into_u32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly, we should call this into_inner(self) and then do the same over on pg_sys::Oid and close #2011.
And there's also no need for this from_u32(xid: u32) function either, because of impl From<u32> for TransactionId down below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_u32 is for const only since traits cannot have that modifier on the functions. It can be removed, but then it won't be possible to use during compiler time.
If there's no need in const fns then I see no reason in from_smthg and into_smthg at all as there are from and into. Makes sense?
| } | ||
|
|
||
| #[inline] | ||
| pub const fn to_u32(self) -> u32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly, we should call this into_inner(self) and then do the same over on pg_sys::Oid and close #2011.
And there's also no need for this from_u32(xid: u32) function either, because of impl From<u32> for TransactionId down below.
|
|
||
| /// An `xid` type from PostgreSQL | ||
| #[repr(transparent)] | ||
| #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also want to impl Display too. Have it just be the u32 value. It's not uncommon to want to convert a transaction id into a string for logging purposes
eeeebbbbrrrr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your diligence on this one, @YohDeadfall !
No description provided.