Skip to content

Export the RowDataPacket, ResultSetHeader and ProcedureCallPacket from MySQL2 #127

@pioupia

Description

@pioupia

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];
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions