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
10 stars 4 forks source link

Connection Factory #40

Open Brayden opened 3 months ago

Brayden commented 3 months ago

Purpose

Currently the way the project is structured, each time we add support for a new connection type it requires the NPM packages to be included for all of them. Our goal is if a user comes to use our SDK and is only seeking to use, say Neon, then we only should require the installation of the Neon serverless driver via NPM.

Tasks

Verify

const connection = await DatabaseFactory.createConnection(DatabaseType.Outerbase, {
        apiKey: 'INSERT_API_KEY'
    });
    const db = Outerbase(connection);

    const { data, error } = await db
        .selectFrom([{ table: 'users', columns: ['*'] }])
        .limit(10)
        .query()

Before

After