2.0.6 • Published 4 years ago

@rededompedro/mysql v2.0.6

Weekly downloads
5
License
ISC
Repository
-
Last release
4 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()
2.0.6

4 years ago

2.0.5

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.3

5 years ago

1.0.1

5 years ago