dobo
Version:
Database ORM/ODM for Bajo Framework
10 lines (8 loc) • 356 B
JavaScript
async function get ({ schema, id, options = {} }) {
const { thrownNotFound = true } = options
const { find } = this.lib._
const result = find(this.memDb.storage[schema.name], { id })
if (!result && thrownNotFound) throw this.error('recordNotFound%s%s', id, schema.name, { statusCode: 404 })
return { data: result }
}
export default get