1

同期クエリのメソッドを作成しようとしています。pg-pool と asyncawait を使用していますが、「エラー: await 関数、yield 関数、および値を返す中断可能な関数は、中断可能な関数内からのみ呼び出すことができます。」

コードは次のとおりです。

CustomPool = function(condigDB){
 this.pool = new Pool(cofigDB)
};

CustomPool.prototype.querySync = function(sql){
    var result = {rows:[]};
    try{
        result = await(this.pool.query(sql));
    }
    catch(_e_){
        Log.exception(_e_);
    }
    return result.rows; 
};

module.exports = CustomPool;
4

0 に答える 0