/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
//const pool = require("./connect");
import {createConnection, QueryError, RowDataPacket} from 'mysql2';

/*const Pool = mysql.createPool({
    host: process.env.HOST,
    user: process.env.DATABASE,
    database: process.env.DATABASE,
    password: process.env.PASSWORD,
    waitForConnections: true,
    connectionLimit: 10,
    queueLimit: 0
});*/

//interface definitionInterface{
//    (message:string):void;
//}

const connection = createConnection({
    host: process.env.HOST,
    user: process.env.DATABASE,
    database: process.env.DATABASE,
    password: process.env.PASSWORD,
    waitForConnections: true,
    connectionLimit: 10,
    queueLimit: 0
});

connection.query('SELECT * FROM `members` WHERE 1', (err: QueryError, rows: RowDataPacket[]) => {
    console.log('The solution is: ', rows);
});

/*export default function Select(sql: string, callback: definitionInterface) {
    pool.getConnection(function(err, conn) {
        conn.query(sql , function(err, rows) {
            callback(rows);
         });
        pool.releaseConnection(conn);
     })

  }*/