[feature request] add shortcut method to get by primary key
tarjei opened this issue · comments
Hi, I often find myself querying for a single entity by an known primary key.
It would be super useful to have this as a separate method find(primaryKey)
.
Hey, @tarjei.
Do I understand you correctly that you'd like to propose a shorthand for this:
const db = factory({
user: { id: primaryKey(String) }
})
// For this particular query by the primary key ("id").
db.user.findOne({
where: { id: { equals: 'abc-123' } }
})