Open SamD opened 7 years ago
As mentioned in the Sequelize documentation here http://docs.sequelizejs.com/en/latest/api/model/#scopeoptions-model
You can have scope functions with parameters.
e.g. complexFunction: function(email, accessLevel) { return { where: { email: { $like: email }, accesss_level { $gte: accessLevel } } } }
then use it like
Model.scope({ method: ['complexFunction' 'dan@sequelize.com', 42]}).findAll()
Since there is no way to currently query based on a value and an associated value I figured I could create a scope; however, epilogue only appears to be able to take a scope name and no parameters.
Is this possible?
Sequelize actually supports using multiple scopes at once, so I think it also should be considered before implementing this feature.
As mentioned in the Sequelize documentation here http://docs.sequelizejs.com/en/latest/api/model/#scopeoptions-model
You can have scope functions with parameters.
e.g. complexFunction: function(email, accessLevel) { return { where: { email: { $like: email }, accesss_level { $gte: accessLevel } } } }
then use it like
Model.scope({ method: ['complexFunction' 'dan@sequelize.com', 42]}).findAll()
Since there is no way to currently query based on a value and an associated value I figured I could create a scope; however, epilogue only appears to be able to take a scope name and no parameters.
Is this possible?