这两个模型定义之间有什么区别吗?他们似乎都工作,我在文档中找不到任何东西。
module.exports = {
schema: true,
attributes: {
state: {
type: 'string',
enum: [
'requested',
'rejected',
'accepted'
]
},
}
}
这一个:
module.exports = {
schema: true,
attributes: {
state: {
type: 'string',
in: [
'requested',
'rejected',
'accepted'
]
},
}
}
我看到particlebanana建议有人使用""这里sails-mysql schema datatypes,但枚举似乎也一样吗?
答案 0 :(得分:1)
它应该相同,基于此参考Waterline Docs
// use the Anchor `in` method for enums
if(prop === 'enum') {
self.validations[attr]['in'] = attrs[attr][prop];
return;
}