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]
该文档不明确,我在他们选择的文档看,但没有什么它需要或如何做我想要的东西:(