Class PostgresStoreAbstract

PostgreSQL datastore abstraction which can be inherited by a specialised bridge class.

Example

class MyBridgeStore extends PostgresStore { constructor(myurl) { super([schemav1, schemav2, schemav3], { url: myurl }); }

async getData() { return this.sqlSELECT * FROM mytable } }

// Which can then be used by doing const store = new MyBridgeStore("postgresql://postgres_user:postgres_password@postgres"); store.ensureSchema(); const data = await store.getData();

Hierarchy

  • PostgresStore

Constructors

Properties

sql: Sql<{}>

Accessors

  • get latestSchema(): number
  • Returns number

Methods

  • Clean away any resources used by the database. This is automatically called before the process exits.

    Returns Promise<void>

  • Ensure the database schema is up to date. If you supplied autocreateSchemaTable to opts in the constructor, a fresh database will have a schema table created for it.

    Throws

    If a schema could not be applied cleanly.

    Returns Promise<void>

  • Get the current schema version.

    Returns

    The current schema version, or -1 if no schema table is found.

    Returns Promise<number>

  • Update the current schema version.

    Parameters

    • version: number

    Returns Promise<void>

Generated using TypeDoc