Skip to content

types/mysql

Repository files navigation

Typed mysql

Greenkeeper badge Build Status

Typescript Typings for mysql.

Installation

typings install --save mysql

or

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

Usage

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

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.query('UPDATE posts SET title = ? WHERE id = ?', ['Hello World', 1], (err: mysql.QueryError, result: mysql.OkPacket) => {
    console.log(result.affectedRows);
});

More examples

Contributing

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


Based on typings by William Johnston