sqlx
sqlx copied to clipboard
feat(cube): support postgres cube
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).
https://github.com/jayy-lmao/sql-gen/issues/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.
Sorry for the build jobs -- running locally the encoding seems to be fine. Haven't been able to replicate locally with amd64 platform, alpine etc. Still figuring out why the encoding is different.
Update: have been able to reproduce by using
let row = s.try_next().await?.unwrap();
let rec = row.try_get::<PgCube, _>(0)?;
Locally to test. Will continue to investigate.
Have handled the text case, tests now passing ☺️
Have made the changes to vector indexing :)
Have made changes
- trimming the input string to make it more flexible for the spec & for user input
- allow for
_cube
array type (And included a test for it) - remove TryFrom behaviour for
&[u8]
, using direct function instead - avoid double creating a buffer, but just writing directly to the
PgArgumentBuffer
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
Note that I only today realized that main
has been broken for the past few weeks and I'm still working on fixing Clippy warnings (turned into errors by CI) from that.
Don't worry about fixing errors in code you didn't touch.
Note that I only today realized that
main
has been broken for the past few weeks and I'm still working on fixing Clippy warnings (turned into errors by CI) from 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 Encode
implementation.
Glad it supports returning errors now ☺️
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 👍