outerbase / sdk

Typescript ORM and automated model generation direct from your database schema. Supports Outerbase features for saved queries & AI.
https://outerbase.com
MIT License
12 stars 5 forks source link

PROPOSAL: Users should be passing in their specific dialect #42

Open caleb-mabry opened 4 months ago

caleb-mabry commented 4 months ago

Is your feature request related to a problem? Please describe. When someone wants to download out repository, it's important for us to not force them to install all of the different sub-dialects like mariadb or mssql. We want to keep our package light.

Describe the solution you'd like We have separate submodules as a part of the SDK that implement a specific Abstract Interface that we have defined. I think we could benefit from following the pattern that Sequelize has implemented. What you'll notice is that they have a "core" module that is in charge of ensuring the abstract interfaces are used properly in the core module.

As you can see here: https://github.com/sequelize/sequelize/blob/main/packages/core/src/sequelize.internals.ts#L18-L52, you wont be forced to install a specific module, rather, you will be passing them in. For each supported module, Sequelize has the appropriate Abstract Interface created https://github.com/sequelize/sequelize/tree/main/packages.

Describe alternatives you've considered I haven't really thought about any additional solutions 😄 , I had given the thought of maybe doing something like a dev dependency install, but that would only be helpful for developing on the SDK rather than making it install with the appropriate library.,

Additional Context

const {mariaDB} = require('mariaDB')

const connection = OuterbaseConnection({
dialect: mariaDB
})
caleb-mabry commented 4 months ago

It also looks like if there is disparity in the child dependency, we can try and add overrides? https://github.com/sequelize/sequelize/blob/main/packages/mysql/src/_internal/data-types-overrides.ts