dctrotz / mysql2

Typings for https://github.com/sidorares/node-mysql2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Typings for https://github.com/sidorares/node-mysql2

License:ISC License


Languages

Language:TypeScript 100.0%