인프런 커뮤니티 질문&답변
스키마 this.rowsForUsersTable 를 변수에 담은뒤 동적으로 설정할수 있을 까요?
작성
·
138
0
https://github.com/hyunsokstar/mes-prototype2/blob/main/backend/src/cats/cats.repository.ts
스키마 this.rowsForUsersTable 를 변수에 담은뒤 동적으로 설정할수 있을 까요?
// fix 1122
async getListByTableName(table_name: string) {
let target_table_name = table_name; // ex rowsForUsersTable
if (target_table_name === "rowsForUsersTable") {
return await this.rowsForUsersTable.find().select('-password');
} else {
return await this.rowsForUsersTable.find({ table_name: table_name }).select('-password');
}
}답변
답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!





.png?w=112)