oracle-query
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

oracle-query

Provide a query builder library to construct / execute Oracle queries.

Init the database connection

import { Db } from 'oracle-query';

Db.init({
  credentials: {
    user: string,
    password: string,
    connectString: string,
  },
  onExec?: (db: Db<any>, outBinds: any) => any,
});

onExec hook will be executed after each query. Useful to map the result or add logging.

Default use case:

import db, { createQuery } from 'oracle-query';

const query = createQuery()
  .pkg('pkg')
  .func('auth')
  .params({
    username: 'tcy',
    pwd: 'a-password',
  });

console.log(query.toString());

/*
  BEGIN 
  :res := pkg.auth(
    USERNAME => 'tcy', 
    PWD      => 'a-password'
  ); 
  END;
*/

const res = await db<string>('fake-user')
  .log(false)
  .query(query)
  .exec();

Documentation in progress ...

Readme

Keywords

none

Package Sidebar

Install

npm i oracle-query

Weekly Downloads

10

Version

0.2.0

License

MIT

Unpacked Size

47.6 kB

Total Files

17

Last publish

Collaborators

  • tcy