How to promise the Return Value of Callback Function? What is returned is a function

  node.js, question

First of all, I used the mysql module of nodejs, which has a connection pool with the following syntax

pool.getConnection(function(err,connection){
 connection.query("USE userInfo",function(err,rows){
 
 });
 });

According to the advice given to me by great gods, I rewrite this code with async/await. an important step is to convert pool.getConnection and connection.query into promise objects

//first promise to pool.getConnection
 var getConn = new Promise(function(resolve,reject){
 pool.getConnection(function(err,connection){
 if (err) {
 reject(err);
 } else {
 resolve(connection);
 bracket
 });
 });

However, connection.query needs the last connection passed back. in the async function, I can write the following code

let connection = await getConn;

But then connection will not be a promise object, and more asynchronous operations will return to the style of callback function, so I want to promise connection.query, but I can only write it inside the async function, and I don’t know how to write an object that can return rows according to the change of query string.

Async function code is as follows. rows can be obtained after running at present

const test = async()=>{
 let connection = await getConn;
 var conn = new Promise(function(resolve,reject){
 connection.query("USE userInfo",function(err,rows){
 if (err) {
 reject(err);
 } else {
 resolve(rows);
 bracket
 });
 });
 let rows = await conn;
 console.log(rows);
 };

How should I write the promise object of connection.query as a function that can pass parameters?