-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Remove seq-macro #1699
Merged
workingjubilee
merged 1 commit into
pgcentralfoundation:develop
from
workingjubilee:remove-seq-macro
May 10, 2024
Merged
Remove seq-macro #1699
workingjubilee
merged 1 commit into
pgcentralfoundation:develop
from
workingjubilee:remove-seq-macro
May 10, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eeeebbbbrrrr
approved these changes
May 10, 2024
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.
👀
Fair.
workingjubilee
commented
May 10, 2024
Comment on lines
+160
to
+196
unsafe impl<'iter, $($C,)*> SqlTranslatable for TableIterator<'iter, ($($C,)*)> | ||
where | ||
$($C: SqlTranslatable + 'iter,)* | ||
{ | ||
fn argument_sql() -> Result<SqlMapping, ArgumentError> { | ||
Err(ArgumentError::Table) | ||
} | ||
fn return_sql() -> Result<Returns, ReturnsError> { | ||
let vec = vec![ | ||
$( | ||
match $C::return_sql() { | ||
Ok(Returns::One(sql)) => sql, | ||
Ok(Returns::SetOf(_)) => return Err(ReturnsError::TableContainingSetOf), | ||
Ok(Returns::Table(_)) => return Err(ReturnsError::NestedTable), | ||
err => return err, | ||
}, | ||
)* | ||
{ | ||
fn argument_sql() -> Result<SqlMapping, ArgumentError> { | ||
Err(ArgumentError::Table) | ||
} | ||
fn return_sql() -> Result<Returns, ReturnsError> { | ||
let mut vec = Vec::new(); | ||
#( | ||
vec.push(match Input~N::return_sql() { | ||
Ok(Returns::One(sql)) => sql, | ||
Ok(Returns::SetOf(_)) => return Err(ReturnsError::TableContainingSetOf), | ||
Ok(Returns::Table(_)) => return Err(ReturnsError::NestedTable), | ||
Err(err) => return Err(err), | ||
}); | ||
)* | ||
Ok(Returns::Table(vec)) | ||
]; | ||
Ok(Returns::Table(vec)) | ||
} | ||
} | ||
|
||
impl<$($C: IntoDatum),*> IntoHeapTuple for ($($C,)*) { | ||
unsafe fn into_heap_tuple(self, tupdesc: pg_sys::TupleDesc) -> *mut pg_sys::HeapTupleData { | ||
// shadowing the type names with these identifiers | ||
#[allow(nonstandard_style)] | ||
let ($($C,)*) = self; | ||
let datums = [$($C.into_datum(),)*]; | ||
let mut nulls = datums.map(|option| option.is_none()); | ||
let mut datums = datums.map(|option| option.unwrap_or(pg_sys::Datum::from(0))); | ||
|
||
|
||
unsafe { | ||
// SAFETY: Caller has asserted that `tupdesc` is valid, and we just went | ||
// through a little bit of effort to setup properly sized arrays for | ||
// `datums` and `nulls` | ||
pg_sys::heap_form_tuple(tupdesc, datums.as_mut_ptr(), nulls.as_mut_ptr()) |
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 half the reason here for this code is that both of these should be the same thing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds some local boilerplate but removes an external proc-macro from our build.