githubEdit

plug-circle-plusCreating Connectors

Build a custom connector to store schemas and data in your own backend.

Create a custom connector when existing don’t fit.

Minimum requirements

Extend the exported Connector base class.

Implement only what you need.

Most connectors start with:

  • listTables(path, auth?)

  • getTable(path, auth?)

  • getData(table, auth?)

CRUD methods are optional, depending on what your source supports:

  • addRow()

  • updateRow()

  • deleteRow()

Skeleton

import { Connector } from 'schemafx';

export default class MyConnector extends Connector {
  async listTables(path: string[], auth?: string) {
    return [];
  }

  async getTable(path: string[], auth?: string) {
    return undefined;
  }

  async getData(table: any, auth?: string) {
    return { type: 'inline', data: [] };
  }

  // Optional CRUD methods.
  async addRow() {}
  async updateRow() {}
  async deleteRow() {}
}
circle-info

Keep the surface area small. Only implement what your source can support reliably.

Next

Wire your connector into SchemaFX in Connecting Data Sources.

Last updated