javascript - Sequelize 文档中的这些井号/井号符号代表什么?

标签 javascript sequelize.js

我的团队正在研究在即将到来的项目中使用的 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/

相关文章:

javascript - 谷歌地图 v3 JavaScript : geojson overlays city and country names

JavaScript 对象赋值 : unexpected behaviour

javascript - highcharts 散点变化点颜色

node.js - 如何在sequelize模型中插入外键

node.js - Postgres SequelizeDatabaseError : syntax error at or near RETURNING

javascript - 连接中的 Sequelize 或条件

javascript - HighCharts 柱形图中的工具提示帮助

javascript - 如何将变量从 Twig 传递到 JavaScript

node.js - 如何在sequelize Nest.JS中添加钩子(Hook)

javascript - Sequelize关联函数没有效果