Skip to content

tcastelly/oracle-query

Repository files navigation

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 ...

About

Oracle query builder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published