1.0.6 • Published 11 months ago

doix-devextreme v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

workflow Jest coverage

doix-devextreme is a DevExtreme adapter for the doix server platform.

As of this writing, it contains only a basic a translator of AJAX requests coming from dxDataGrid into DbQuery instances.

Installation

npm install doix-devextreme

Initialization

doix-devextreme is a plug in for database clients, such as DbClientPg. It can be attached to any database connection pool by calling the plugInto method:

const {DbPoolPg}   = require ('doix-db-postgresql')
const dx = require ('doix-devextreme')

const db = new DbPoolPg ({
  db: conf.db,
  logger: createLogger (conf, 'db'),
})

dx.plugInto (db)

After that, each db instance injected into a Job will have the dxQuery method described in the next section.

Using in application code

With doix-devextreme plugged in, the db resource provides the dxQuery method having the same parameters as DbModel.createQuery:

select_users:    
  async function () {
    const {db} = this
    const query = db.dxQuery ([['users']], {order: ['label']})
    const list = await db.getArray (query)
    return {
      all: list, 
      cnt: list [Symbol.for ('count')], 
      portion: query.options.limit
    }
  }

In fact, this is the db.model.createQuery call, but with some additions from this.request.loadOptions:

  • the limit and offset options are overridden with take and skip respectively;
  • the order list is replaced with the translated sort, if any (so the order passed in argument acts as a default value);
  • the 1st query table filter option is appended with the translated filter.

Limitations

To date, IS NULL predicates are never generated.

1.0.6

11 months ago

1.0.5

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago