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

docs: add knex examples #263

Merged
merged 2 commits into from
Nov 24, 2023
Merged

docs: add knex examples #263

merged 2 commits into from
Nov 24, 2023

Conversation

ruyadorno
Copy link
Contributor

Adds examples of using the connector with knex for pg, mysql2, and tedious drivers.

Fixes: #111
Includes the original contribution from @edosrecki: #191

@ruyadorno ruyadorno requested a review from a team as a code owner November 24, 2023 19:30
@ruyadorno ruyadorno force-pushed the add-examples-knex branch 3 times, most recently from 8b662e8 to caf7a6b Compare November 24, 2023 19:47
Added sample tests to the `knex` examples.

Fixes: #111
Closes: #191
@ruyadorno ruyadorno merged commit fabe9b6 into main Nov 24, 2023
30 checks passed
@ruyadorno ruyadorno deleted the add-examples-knex branch November 24, 2023 19:56
const {Connector} = require('@google-cloud/cloud-sql-connector');
const knex = require('knex');

async function connect({ instanceConnectionName, user, databaseName }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the test you are passing argument db and here it is called databaseName. Also, isn't expected property name in connectionOptions called database?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! fixing it here: #264

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.

Document usage for Knex
3 participants