我的团队正在研究在即将到来的项目中使用的 javascript ORM 框架,但我无法弄清楚这些 # 符号在 Sequelize 中到底意味着什么。文档,但我知道这是无效的 JS。
这是取自 docs here 的示例:
// this will add the attribute DadId to Person
Person.hasOne(Person, {as: 'Father', foreignKey: 'DadId'})
// In both cases you will be able to do:
Person#setFather
Person#getFather
我可能错过了他们文档中的某些内容,但我找不到任何有帮助的引用。
最佳答案
这是记录类方法的常见方法。
在这种情况下,文档说:
The Person class has an instance method named setFather
The Person class has an instance method named getFather
这是 Ruby 中的惯用法,我个人从未见过它用于 JS
关于javascript - Sequelize 文档中的这些井号/井号符号代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28181872/