Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SqlDataSourceAdapter<T>

Data source defining how to connect to an manipulate data from a sqlite file

Type parameters

  • T

Hierarchy

  • SqlDataSourceAdapter

Implements

Index

Constructors

constructor

  • Instantiates a connection obejct, and adds a new data source to the store

    Parameters

    • store: Store<ModelState>

      The store to dispatch events to

    • filename: string

      The database file to read

    Returns SqlDataSourceAdapter

  • Instantiates a connection obejct, and adds a new data source to the store

    Parameters

    • store: Store<T>

      The store to dispatch events to

    • filename: string

      The database file to read

    • _selector: function

      A selector function defining how to find the ModelState fragment of state T

    Returns SqlDataSourceAdapter

Properties

Private _conn

_conn: Knex

Private _selector

_selector: function

A selector function defining how to find the ModelState fragment of state T

Type declaration

id

Private store

store: Store<T>

The store to dispatch events to

Methods

assertConnection

  • assertConnection(): void

defaultFieldSelection

  • defaultFieldSelection(selectNumber?: number): Promise<void>
  • Asynchronously fetches some number of fields and sets them as active inside the model Resolves when the action adding all the default fields has been dispatched

    Parameters

    • Default value selectNumber: number = 2

    Returns Promise<void>

describeColumns

  • describeColumns(table: string): Promise<any>
  • Returns a promise to a list of the columns in a given table in a sql db

    Parameters

    • table: string

    Returns Promise<any>

describeTables

  • describeTables(): Promise<any>
  • Returns a promise to a list of the tables in the sql db

    Returns Promise<any>

remove

  • remove(): Promise<void>
  • Removes the data source associated with this adapter from the store and destroys the connection

    Returns Promise<void>

updateCache

  • updateCache(): Promise<Array<any>>
  • Given the fields selected in the store, updates the cached data in the store fore those fields Resolves when the action updating the data in the store has been dispatched

    Returns Promise<Array<any>>

Generated using TypeDoc