0
試圖選擇帶有書架和連字符號的列。我的db是postgresql。在knex,我不喜歡這樣寫道:如何連接bookshelf.js中的列?
knex('client_users')
.select(
'client_user_id as id',
'status',
'email',
'last_login_date as lastLoginDate',
knex.raw(`CONCAT(first_name, ' ', last_name) as "displayName"`)
)
.whereIn('client_user_id', clientUserIds)
.andWhere('status', 'pending')
.tap(clientUsers => console.log('clientUsers retrieved:', clientUsers));
它的工作和回報:
[{
id: 1,
status: 'pending',
email: '[email protected],
lastLoginDate: [Date Object],
displayName: 'John Smith'},
{...}, {...}, etc]
該文檔不明確,我在他們選擇的文檔看,但沒有什麼它需要或如何做我想要的東西:(