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: neon connector #117

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

Conversation

arashsheyda
Copy link
Contributor

πŸ”— Linked issue

related to #32

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

this PR adds support for neon connector using @neondatabase/serverless + an example of neon

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 33 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@61e6c3f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/connectors/neon.ts 25.58% 32 Missing ⚠️
src/_connectors.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #117   +/-   ##
=======================================
  Coverage        ?   41.47%           
=======================================
  Files           ?       23           
  Lines           ?      892           
  Branches        ?       91           
=======================================
  Hits            ?      370           
  Misses          ?      516           
  Partials        ?        6           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

return getConnection().then((c) => c(this._sql, params || this._params));
},
run(...params) {
return getConnection().then((c) => c(this._sql, params || this._params));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

run is supposed to only return success right? currently we are returning whatever we get back, so I should change that?

Copy link
Member

Choose a reason for hiding this comment

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

Can you confirm what is production behavior of neon currently? Ideally if it returns additional info, it seems to be correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm so sorry, I've missed your comments πŸ₯² sure that sounds good

Copy link
Member

@pi0 pi0 Oct 30, 2024

Choose a reason for hiding this comment

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

In the examples dir, we don't have connectors which are documented (only integrations) -- this can be reverted and instead improve tests.

import connector from "../../src/connectors/neon";
import { testConnector } from "./_tests";

describe.runIf(process.env.POSTGRESQL_URL)(
Copy link
Member

Choose a reason for hiding this comment

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

I wish we could somehow mock @neondatabase/serverless (not sure if in their SDK they have it already). We could use something like pglite to emulate their interface in order to allow automated tests.


export default function neonConnector(opts: ConnectorOptions) {
let _connection: NeonQueryFunction<undefined, undefined>;
const getConnection = async () => {
Copy link
Member

Choose a reason for hiding this comment

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

This seems can be non async right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true!

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