У меня есть следующий запрос в PostgreSQL:
select bookings."memberId" from bookings
join "memberConnections" mbc on bookings."memberId" = mbc."memberId"
join shifts shf on shf.id = bookings."shiftId"
where bookings.state = 'WAITING_LIST' and (mbc.state = 'LOCKED' or mbc.state = 'REMOVED')
and shf."startTime" > CURRENT_TIMESTAMP;
Я импортирую его в файл, затем обрабатываю данные через библиотеку Knex.js
Когда я запускаю его иконсоль лог запрос, я получаю следующую структуру:
USER_STATE: Result {
command: 'SELECT',
rowCount: 32,
oid: NaN,
rows:
[ anonymous { memberId: 1800 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 12553 },
anonymous { memberId: 12553 },
anonymous { memberId: 19668 },
anonymous { memberId: 19668 },
anonymous { memberId: 21004 },
anonymous { memberId: 21004 },
anonymous { memberId: 21004 },
anonymous { memberId: 21004 },
anonymous { memberId: 16105 },
anonymous { memberId: 14927 },
anonymous { memberId: 15476 },
anonymous { memberId: 12553 },
anonymous { memberId: 12553 },
anonymous { memberId: 12553 },
anonymous { memberId: 12553 },
anonymous { memberId: 17923 },
anonymous { memberId: 17273 },
anonymous { memberId: 12553 },
anonymous { memberId: 12553 },
anonymous { memberId: 19429 },
anonymous { memberId: 17312 },
anonymous { memberId: 17273 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 15476 },
anonymous { memberId: 19634 } ],
fields:
[ Field {
name: 'memberId',
tableID: 22531,
columnID: 3,
dataTypeID: 23,
dataTypeSize: 4,
dataTypeModifier: -1,
format: 'text' } ],
_parsers: [ [Function: parseInteger] ],
RowCtor: [Function: anonymous],
rowAsArray: false,
_getTypeParser: [Function: bound ] }
Это почти то, что мне нужно, однако мне просто нужны данные memberId, есть ли способ, как я могу отобразить через него, чтобы только вернуться назадсвойства memberId?
Я пробовал это, но это не похоже на работу:
const users = userState.map(users => ({
memberId: memberId;
}))