Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing values when using scopes #204

Open
SamD opened this issue Jan 12, 2017 · 1 comment
Open

Passing values when using scopes #204

SamD opened this issue Jan 12, 2017 · 1 comment

Comments

@SamD
Copy link

SamD commented Jan 12, 2017

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?

@G07cha
Copy link

G07cha commented Apr 7, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants