UNPKG

dobo

Version:

DBMS for Bajo Framework

17 lines (14 loc) 659 B
import { getFilterAndOptions, execHook, execModelHook } from './_util.js' const action = 'drop' async function drop (opts = {}) { opts.dataOnly = opts.dataOnly ?? true const { dataOnly } = opts const { options } = await getFilterAndOptions.call(this, null, opts, action) await execHook.call(this, 'beforeDropModel', options) await execModelHook.call(this, 'beforeDropModel', options) const result = (await this.driver._dropModel(this, options)) ?? {} await execModelHook.call(this, 'afterDropModel', result, options) await execHook.call(this, 'afterModelDrop', result, options) return dataOnly ? result.data : result } export default drop