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(pglite): use async init #130

Merged
merged 7 commits into from
Jan 27, 2025
Merged

feat(pglite): use async init #130

merged 7 commits into from
Jan 27, 2025

Conversation

sandros94
Copy link
Contributor

Proposed in sandros94/nuxt-pglite#7, these changes improve typing for newly created PGlite instance that do have extensions added.

This also make sure that the PGlite instance is ready before executing any query (.create internally also awaits for .waitReady).

I've also changed the following default because in rare occasions PGlite forcefully tries to find params in an empty array, hanging without notice:

-async function query(sql: string, params: unknown[] = []) {
+async function query(sql: string, params: unknown[] = undefined) {

@sandros94
Copy link
Contributor Author

The mention in the nuxt/ui issue was just my copy/paste not working correctly.

Got a new keyboard now 😬

Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@97630f3). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #130   +/-   ##
=======================================
  Coverage        ?   42.32%           
=======================================
  Files           ?       22           
  Lines           ?      860           
  Branches        ?       89           
=======================================
  Hits            ?      364           
  Misses          ?      492           
  Partials        ?        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/connectors/pglite.ts Outdated Show resolved Hide resolved
src/connectors/pglite.ts Outdated Show resolved Hide resolved
@pi0 pi0 marked this pull request as draft January 24, 2025 20:16
@pi0 pi0 marked this pull request as ready for review January 27, 2025 16:54
@pi0 pi0 changed the title fix(PGlite): improve type support refactor(pglite): improve types Jan 27, 2025
@pi0 pi0 changed the title refactor(pglite): improve types feat(pglite): use async init Jan 27, 2025
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks! (made few changes)

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks! (made few changes)

@pi0 pi0 merged commit 440fa9d into unjs:main Jan 27, 2025
2 checks passed
@sandros94 sandros94 deleted the fix-pglite-typing branch January 27, 2025 21:57
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.

2 participants