我正在使用通用挂钩,但是我遇到了一个问题:我找不到模型名称或表名称。
const sequelize = new Sequelize(database, username, password, {
host: host,
dialect: dialect,
pool: {
max: pool.max,
min: pool.min,
acquire: pool.acquire,
idle: pool.idle,
},
logging: (msg) => logger.debug(msg),
define: {
hooks: {
afterCreate(instance, options) {
console.log(instance);
}
}
}
});
在控制台日志中,我得到了:
superRoles {
dataValues: {
id: 1,
nombre: 'SUPERUSUARIO',
permisos: '{}',
updatedAt: 2020-11-04T06:36:11.352Z,
createdAt: 2020-11-04T06:36:11.352Z
},
_previousDataValues: { nombre: undefined, permisos: undefined, id: null },
_changed: Set { 'nombre', 'permisos', 'id' },
_options: {
isNewRecord: true,
_schema: null,
_schemaDelimiter: '',
attributes: undefined,
include: undefined,
raw: undefined,
silent: undefined
},
isNewRecord: false
}
如何获取模型或 superRoles 值?
答案 0 :(得分:0)