Sequelize 文档中的这些哈希/磅符号代表什么

What do these hash/pound symbols in the Sequelize docs represent?

本文关键字:符号 什么 哈希 文档 Sequelize      更新时间:2023-09-26

我的团队正在研究javascript ORM框架以用于即将到来的项目,但我无法弄清楚这些#符号在Sequelize文档中到底是什么意思,但我知道这是无效的JS。

以下是此处文档中的示例:

// 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