1.0.4 • Published 6 years ago

@dev2world/mysql v1.0.4

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

MySQL

Build Status

A MySQL Wrapper for https://github.com/mysqljs/mysql that wraps function calls with promises. Currently we only support pool connections.

Installation

npm i @dev2world/mysql

yarn add @dev2world/mysql

Usage

const mysql = require('@dev2world/mysql');

const config = {
    password: 'secret',
    user: 'root',
    host: 'localhost',
    port: 3306,
    database: 'db_test',
    connectionLimit: 3
};

const pool = mysql.createPool(config);

(async () => {
  let results = await pool.query('SELECT * FROM db.table')
})()

Transactions

const conn = await pool.getConnection()
await conn.beginTransaction()
let result = await conn.query('INSERT INTO db_test.new_table(name, address) VALUES("Testando", "Testando")')
await conn.commit()
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago