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

Connection constructor named object #26

Merged
merged 3 commits into from
Jun 5, 2024
Merged

Conversation

Brayden
Copy link
Member

@Brayden Brayden commented May 23, 2024

Purpose

Previously for classes that implemented Connection interface, each constructor could have it's own custom arguments needed to fulfill it's classes usage. When you list out the arguments when constructing a new instance of it you would have to know what argument goes in what order, and the arguments differ per Connection class.

This change makes it so each Connection constructor now takes an object that has a type associated to it so you can see what the values required are.

Resolves #10

Tasks

  • Update the OuterbaseConnection constructor to support a OuterbaseConnectionDetails type in the constructor
  • Update the CloudflareD1Connection constructor to support a CloudflareD1ConnectionDetails type in the constructor

Verify

  • You can still instantiate and query a Cloudflare connection
  • You can still instantiate and query an Outerbase connection

Before

const d1 = new CloudflareD1Connection(
    'API_KEY',
    'ACCOUNT_ID',
    'DATABASE_ID'
)

After

const d1 = new CloudflareD1Connection({
    apiKey: 'API_KEY',
    accountId: 'ACCOUNT_ID',
    databaseId: 'DATABASE_ID'
})

@Brayden Brayden added the enhancement New feature or request label May 23, 2024
@Brayden Brayden self-assigned this May 23, 2024
@Brayden Brayden merged commit f1b1b7a into main Jun 5, 2024
1 check passed
@Brayden Brayden deleted the bwilmoth/constructor-objects branch June 5, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constructors as parameters or a single key/value object
2 participants