Get Remove them ORMs from your Projects.

-- mysql
---- mysql.ts
---- pool-connector.ts
npm i -D @types/mysql @types/node tslib typescript && npm i mysql
export abstract class MySQL {
private _pool: mysql.Pool;

protected constructor (config);
private getConnection ();
private runQuery (connection,sql,opts);
private beginTransaction (connection);
private commitTransaction (connection);
protected read (sql, opts);
protected write (sql, opts);

Private methods

  • getConnection — gets a connection from the pool.
  • runQuery — executes an sql statement.
  • beginTransaction — as the name says.
  • commitTransaction — write data into them tables.

Protected Methods

  • read — runs none transactional sql statements such as selects.
  • write — runs transactional sql statements such as inserts.
export interface AccountsProps {
id: number;
name: string;
last: string;
export class Accounts extends PoolConnector<AccountsProps> {}



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store