¿如何从表中检索所有属性,以及每行具有常量值的新列/属性? 正如我在文档中看到的那样,它与此类似:
my_model.findAll({
attributes:{
include:[['constant_value','new_attribute_name']]
}
}).then(...);
有任何线索吗?
谢谢!
答案 0 :(得分:1)
您可以在续集中使用文字函数。
my_model.findAll({
attributes:{
include: [[Sequelize.literal(`"constant_value"`,'new_attribute_name']]
}
}).then(...);
我刚刚看到这个问题是很久以前发布的,但是我希望这对其他人有帮助。谢谢
答案 1 :(得分:0)