Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 992 Bytes

README.md

File metadata and controls

38 lines (26 loc) · 992 Bytes

Typed mysql2

Greenkeeper badge Build Status

Typescript Typings for mysql2.

Installation

typings install --save mysql2

or

npm install --save-dev types/mysql2#semver:version

Usage

import {createConnection, QueryError, RowDataPacket} from 'mysql2';

const connection = createConnection(process.env['DB']);

connection.query('SELECT 1 + 1 AS solution', (err: QueryError, rows: RowDataPacket[]) => {
    console.log('The solution is: ', rows[0]['solution']);
});

connection.execute('UPDATE posts SET title = ? WHERE id = ?', ['Hello World', 1], (err: QueryError, result: OkPacket) => {
    console.log(result.affectedRows);
});

More examples

Contributing

You can run them the tests with npm run build and npm run test.