question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Architectural design suggestion

See original GitHub issue

Hey @eveningkid, I want to contribute to this project, and when I read the code I noticed that you specify manually the DB types this library support https://github.com/eveningkid/denodb/blob/10d6447ac23a6b936ffbcfa5e0bc8a39e1c1f899/lib/database.ts#L56-L60

Then I though that it should have plugin architecture in a way that you should write something like:

// PostgresConnector and PostgresTranslator are a constructor
// PostgresPlugin will have {connector: PostgresConnector, translator: PostgresTranslator}
Database.register(PostgresPlugin)

Advantages

  • Extract the implementation
  • Reduce bundle size:
    • Only import DB connector that in use
  • In case of a change in one connector no need to redeploy
  • Solve the issue when some DB API change between DB versions

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eveningkidcommented, Sep 21, 2020

I think we’re good. If there is anything you want to talk about, feel free to use this issue or the PR you’ll create 😃

This might be quite a huge PR btw so try to keep it as simple as possible. I am sure you will do great!

You really have space to do what you feel is right so give it a try!

1reaction
rluvatoncommented, Sep 20, 2020

I think these details are about the implementation, not what the user will think about. What I mean is that, if this comes with a translator and others, this is not something the user cares about.

Yeah, I was talking about the implementation cause I was thinking about how to implement it.

This is what could happen under-the-hood:

class PostgreSQLConnector extends Connector {
  constructor(config) {
    this.translator = new PostgreSQLTranslator(); // or SQLTranslator() I forgot
    this.config = config;
  }
}

That looks fine 👍 , do you want me to start to implement it or there are things we forget to talk about?

If I think about what’s the simplest way of writing this (from our experience using ORMs), you just want to create a database and pass a configuration to it. No need to register anything else, even if we as developers see this as a plugin, right?

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

20 Architecture Tips from 2021 | ArchDaily
Accompanied by examples, ideas, suggestions and even materiality on some ... For architects, the work of designing safe cities and homes is ...
Read more >
5 Design Tips to Design like an Architect - Designer Hacks
1. Develop a Concept A concept is likely one of the first things you will learn about in architecture or design school. ·...
Read more >
5 Ways to Improve Your Home Through Architectural Design
We believe architectural design-focused home remodels achieve the best result. Read on. ... Open floor plan tip: create well-defined spaces.
Read more >
Home Design: A Step-By-Step Guide To Designing Your ...
UK Self Build Experts, AC Architects. Home Design: A Step-By-Step Guide To Designing Your Dream Home.
Read more >
30 Best House Design Ideas 2021 - Homebuilding & Renovating
We've found 30 brilliant house design ideas to inspire your building project in 2021.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found