ITADN

Export the `RowDataPacket`, `ResultSetHeader` and `ProcedureCallPacket` from MySQL2

#127Openpioupia 创建于 2023-09-29
P
pioupiacommented
### Prerequisites - [X] I have written a descriptive issue title - [X] 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 ```ts 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]; }); ```
1 条评论