Skip to content

Ideal API #27

@amilajack

Description

@amilajack

The API from sqlectron was pretty unorganized. Because falcon-core was a fork of it, we had to borrow its architecture. I think core has matured enough to the point where we can migrate away from sqlectron's API and move towards one of our own: one that's more object oriented and namespaced to allow for faster imports, which we need. To keep a lot of the lower level database specific logic out of the UI, this newer API for falcon-core should be higher level.

import { ConnectionPool, ConnectionManager } from 'falcon-core';
import { SqliteProvider } from 'falcon-core/sqlite';

const connetionManager = new ConnetionManager();
const pool = new ConnectionPool();
const provider = new SqliteProvider();

const dbConn = await provider.connect({
  database: 'demo.sqlite',
  readonly: true
});
connectionManager.add(dbConn.config);
pool.add(dbConn);

// Connect to a favorite connection
const [firstConnection] = await connectionManager.getAll();
firstConnection.connect();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions