-
-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
When you want to use this plugin with TypeScript, you'll probably need to specify the return type of your MySQL query (see here: https://github.com/sidorares/node-mysql2/blob/HEAD/documentation/en/TypeScript-Examples.md).
It might therefore be worthwhile simply to export MySQL2's RowDataPacket
, ResultSetHeader
and ProcedureCallPacket
types.
Motivation
No response
Example
import fastifyMysql, { RowDataPacket } from '@fastify/mysql';
fastify.get('/', async () => {
const connection = fastify.mysql;
// SELECT
const [rows, fields] = await connection.query<RowDataPacket[]>('SELECT 1 + 1 AS `test`;');
/**
* @rows: [ { test: 2 } ]
*/
return rows[0];
});