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

Support for scalar values in .on, .andOn, etc. or similar #1923

Closed
boutell opened this issue Feb 18, 2017 · 3 comments
Closed

Support for scalar values in .on, .andOn, etc. or similar #1923

boutell opened this issue Feb 18, 2017 · 3 comments

Comments

@boutell
Copy link

boutell commented Feb 18, 2017

Right now if I need to compare something to a scalar value (a simple string I'm passing in) in an "on" clause I have to write:

          q.leftJoin('opinions as my_opinions', function() {
            this.on('my_opinions.post_id', 'posts.id');
            this.onIn('my_opinions.user_id', [ query.my_user_id ]);
          });

How about:

this.onScalar('my_opinions.user_id', query.my_user_id)

It would make sense to also have andOnScalar and orOnScalar.

@blackmatch
Copy link

I really want this.

@elhigu
Copy link
Member

elhigu commented Jul 6, 2017

There are much more in this issue to have overall better ways to do identifier references without need to use knex.raw everywhere and this one would be the other way around.

I would prefer some other way to achieve this than duplicate every API with variants for referring values instead of identifiers. Something like:

this.on('my_opinions.user_id', literal('im not an identifier'))

@wubzz
Copy link
Member

wubzz commented Aug 1, 2018

Closing in favour of #2707

@wubzz wubzz closed this as completed Aug 1, 2018
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

4 participants