I am using pg-promise:
class Test{
constructor(){
this.a = db.any('SELECT * FROM test');
}
}
If I call test.a
, it will return Promise { <pending> } }
.
How do I handle this problem? I cannot use .then()
to solve this problem, because I hope the value can be stored in this.a
before return.