sequelize for NodeJS: are these features supported?

风流意气都作罢 提交于 2019-12-05 10:59:53
sdepold

1.: You can use for super duper batch processing the QueryChainer. Nevertheless, every command will be executed separated.

2.: Using the QueryChainer, the success event will only be triggered if everything was fine. Error is triggered if there occured one or multiple errors. The first param of the bound method will be an array of errors.

3.: Hmm I'm not 100% sure, but imho it's not yet supported.

4.: Nope not possible but more complicated and less fancy with:

crowd.getPeople().success(function(people) {
  people.forEach(function(person){
    person.getPets().success... // you have to collect them on your own
  })
})

5.: Nope. But I also don't understand why you would do that.

6.: Yep, check this http://sequelizejs.com/docs/1.7.8/models#expansion-of-models and:

Person = sequelize.define('Person', {foo:Sequelize.STRING}, {
  instanceMethods: {
    fullname: function() {
      return this.firstName + ' ' + this.lastName
    }
  }
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!