-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(cube): support postgres cube #3188
Conversation
Sorry for the build jobs -- running locally the encoding seems to be fine. Update: have been able to reproduce by using
Locally to test. Will continue to investigate. |
Have handled the text case, tests now passing |
Have made the changes to vector indexing :) |
sqlx-postgres/src/types/cube.rs
Outdated
} | ||
} | ||
|
||
impl TryFrom<&str> for PgCube { |
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.
This should be a FromStr
impl.
It's fine to have both, but it's surprising to have a TryFrom<&str>
impl and not a FromStr
impl.
The only reason to do that is if Self
wants to borrow from the string (think zero-copy parsing) which the FromStr
trait doesn't support due to its lack of a lifetime bound.
Have made changes
|
Apologies, I've been away for a little - I've addressed all comments but if there's any other changes that are wanted let me know |
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.
@jayy-lmao one last thing, since #3126 was merged, you'll need to rebase and fix the compilation errors.
Note that I only today realized that Don't worry about fixing errors in code you didn't touch. |
Just saw this then. Oh well, at least I've resolved the changes in Let me know if I can be any help with the errors. |
@abonander have rebased onto main now that builds are passing, and updated to address new linting rules 👍 |
* feat: add cube * docs: cube docs * docs: update readme * fix: cube is now not feature flagged * fix: formatting * fix: typeo for PgCube vs Cube * fix: correct types * fix: postgres only types for cube * fix: cube readme * fix: dont unwrap cubes * fix: typo on interval * fix: zero volume cube array * fix: return type * fix: update tests * fix: run with one test type * fix: log bytes in error * fix: typo in test * fix: log bytes for failed length * fix: string deser * docs: remove cube from readme * fix: int to float * fix: trim floats * fix: exttra test * fix: type safe into vectors * fix: improve error messages * docs: remove comments * fix: front load most important logic and const at start * fix: extract constants * fix: flags * fix: avoid redundant buffer creation and use FromStr trait * fix: handle serializing * test: cube vec test * fix: no array cube test * fix: update test with array for cube * fix: dont use try from for u8 * fix: conditionally remove padding * fix: conditional trimming * fix: idiomatic trimming * fix: linting * fix: remove whitespace * fix: lower case array * fix: spacing input * test: one more vec test * fix: trim square brackets in case they are using postgres spec page * fix: result types * fix: format * fix: box error * fix: the borrow produces a value * fix: self serialise * chore: merge main * fix: borrow * fix: clippy --------- Co-authored-by: James Holman <james.holman@betashares.com.au>
* feat: add cube * docs: cube docs * docs: update readme * fix: cube is now not feature flagged * fix: formatting * fix: typeo for PgCube vs Cube * fix: correct types * fix: postgres only types for cube * fix: cube readme * fix: dont unwrap cubes * fix: typo on interval * fix: zero volume cube array * fix: return type * fix: update tests * fix: run with one test type * fix: log bytes in error * fix: typo in test * fix: log bytes for failed length * fix: string deser * docs: remove cube from readme * fix: int to float * fix: trim floats * fix: exttra test * fix: type safe into vectors * fix: improve error messages * docs: remove comments * fix: front load most important logic and const at start * fix: extract constants * fix: flags * fix: avoid redundant buffer creation and use FromStr trait * fix: handle serializing * test: cube vec test * fix: no array cube test * fix: update test with array for cube * fix: dont use try from for u8 * fix: conditionally remove padding * fix: conditional trimming * fix: idiomatic trimming * fix: linting * fix: remove whitespace * fix: lower case array * fix: spacing input * test: one more vec test * fix: trim square brackets in case they are using postgres spec page * fix: result types * fix: format * fix: box error * fix: the borrow produces a value * fix: self serialise * chore: merge main * fix: borrow * fix: clippy --------- Co-authored-by: James Holman <james.holman@betashares.com.au>
I work on a sqlx codegen tool, and had an issue posted about the lack of support for the 'cube' extension type (https://www.postgresql.org/docs/current/cube.html).
jayy-lmao/sql-gen#9
I could not see any outstanding issues / PRs involving Cube, so can create an issue first if necessary for discussion.
Not particularly attached to how to structure the struct, serialisation, or deserialisation - ultimately just want to be able to support it for my sql-gen tool so that @yellowHatpro can carry on with using it for their project.