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

feat(postgres): add geometry path #3716

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jayy-lmao
Copy link
Contributor

Does your PR solve an issue?
Part 5 of fixing #166
(Breaking apart #3449)

@jayy-lmao jayy-lmao changed the title feat: add postgres geometry path feat(postgres): add geometry path Jan 30, 2025
#[derive(Debug, Clone, PartialEq)]
pub struct PgPath {
pub closed: bool,
pub points: Vec<PgPoint>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how we feel about recycling the PgPoint type for this purpose?

Comment on lines +85 to +99
if parts.len() % 2 != 0 {
return Err(Error::Decode(
format!("Unmatched pair in PATH: {}", s).into(),
));
}

for chunk in parts.chunks_exact(2) {
if let [x_str, y_str] = chunk {
let x = parse_float_from_str(x_str, "could not get x")?;
let y = parse_float_from_str(y_str, "could not get y")?;

let point = PgPoint { x, y };
points.push(point);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably the logic most unique to this type

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.

1 participant