Skip to content

Conversation

itowlson
Copy link
Contributor

@itowlson itowlson commented Aug 15, 2025

Fixes #79 and #80

Draft for now because:

  • Make deps opt-out, and make new code appropriately conditional:
    • New deps: uuid, rust-decimal, postgres-range
    • Condition new code: serde, serde-json
  • Figure out a solution for decoding NUMERICRANGE It's a horrible solution. But here we are
  • Possibly reorganise the file as it's getting a bit ginormous
  • Testing units, and example works on my machine
  • Examples I did one for ranges which are the trap, can do more if suitably motivated
  • Check documentation
  • Document workaround for range query grammar ambiguity New database APIs for Spin 3.4 spin-docs#119

@itowlson itowlson linked an issue Aug 15, 2025 that may be closed by this pull request
@itowlson
Copy link
Contributor Author

Because the new code feature-gates several functions and implementations, I added a couple of GH checks to make sure I hadn't messed up the gating. (I had. Of course I had.) These turned up a couple of errors with --no-default-features in unrelated existing code. I've included fixes for that in this PR, even though it's unrelated to the PostgreSQL/SQLite interfaces: let me know if you want me to move it out.

@itowlson itowlson force-pushed the spin-3.4-interfaces branch from a4378b2 to 44350d6 Compare August 18, 2025 03:12
Signed-off-by: itowlson <[email protected]>
@itowlson itowlson force-pushed the spin-3.4-interfaces branch from cb606c3 to 978a1b3 Compare August 18, 2025 03:21
@itowlson itowlson marked this pull request as ready for review August 18, 2025 22:39
@itowlson itowlson added the v-next This is tied to an upcoming Spin release and should not be merged until that release is out label Aug 19, 2025
Copy link
Contributor

@fibonacci1729 fibonacci1729 left a comment

Choose a reason for hiding this comment

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

Code looks good to me. I tested locally and things worked great. Going to ping another maintainer for another set of 👀

@fibonacci1729 fibonacci1729 requested a review from lann August 19, 2025 20:04
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

I'm not really sure how I feel about keeping around the old interfaces. I understand the reasoning behind it, but I do worry this will be maintenance burden in the future.

/// # }
/// ```
#[doc(inline)]
pub use super::wit::pg4::Connection;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ther's no concept of default for Postgres databases (Spin doesn't provide an implementation - it's address-based rather than label-based).

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true, but the rows method does seem like it would be useful, no?

}
}

impl Decode for bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

A macro to generate the impls for all of these primitive types might make things easier to read 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How strongly do you feel about doing that as part of this PR? The code here follows pg/pg3: I like the idea of a macro but I assume we'd prefer to apply it across all versions (or all versions that we retain).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly about this. Just a thought.

@itowlson itowlson removed the v-next This is tied to an upcoming Spin release and should not be merged until that release is out label Aug 26, 2025
@itowlson itowlson merged commit d675dbc into spinframework:main Aug 26, 2025
3 checks passed
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.

Support spin:[email protected] interface Support spin:[email protected] interface
3 participants