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

Query should run values through isetter also #46

Closed
Jaymon opened this issue Jun 26, 2017 · 2 comments
Closed

Query should run values through isetter also #46

Jaymon opened this issue Jun 26, 2017 · 2 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Jun 26, 2017

I'm not sure if it does this or not, but Query should run values through the isetter method also before it runs the query, that way if you have a mapping from String to int in the isetter methods, say something like:

mapping = {
    "foo": 1,
}

Then doing something like:

MyOrm.query.is_name("foo")

the "foo" value would be converted to 1 before running the query.

@Jaymon
Copy link
Owner Author

Jaymon commented Dec 13, 2017

I think I can add a classmethod Field.iwhere that can be called anytime a field is set in the query. What I don't like about this is it might couple Query and Orm too tightly again and I just got finished uncoupling them

@Jaymon
Copy link
Owner Author

Jaymon commented Dec 17, 2020

This was solved with the Field.iquery(query, v) method that gets run everytime a field is set in a query. The reason why this had to be a different method than Field.iset is because the iset method takes an orm instance and the Query instance often doesn't have an orm instance to pass to the iset method.

@Jaymon Jaymon closed this as completed Dec 17, 2020
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

1 participant