epilogue icon indicating copy to clipboard operation
epilogue copied to clipboard

Passing values when using scopes

Open SamD opened this issue 9 years ago • 1 comments

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' '[email protected]', 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?

SamD avatar Jan 12 '17 02:01 SamD

Sequelize actually supports using multiple scopes at once, so I think it also should be considered before implementing this feature.

G07cha avatar Apr 07 '17 11:04 G07cha