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

Adding a dynamic query builder with more options #437

Closed
Geowan opened this issue Apr 23, 2019 · 0 comments
Closed

Adding a dynamic query builder with more options #437

Geowan opened this issue Apr 23, 2019 · 0 comments

Comments

@Geowan
Copy link

Geowan commented Apr 23, 2019

In the current query builder i can perform something like

const users = await User.query().select('first_name','last_name','username','status','email')
                      .orderBy(inputdata.order_by, inputdata.mode)

In some situations you may need to run the orderBy only if inputdata.orderby is not null.

So am thinking of something like

    const users =  User.query().select('first_name','last_name','username','status','email')
     if(inputdata.order_by){
         users.orderBy(inputdata.order_by, inputdata.mode)
     }

In the documentation i cannot find a similar way to achieve the above? Is this already there?

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