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

BETWEEN queries #19

Closed
Gamaroff opened this issue Jan 10, 2013 · 4 comments
Closed

BETWEEN queries #19

Gamaroff opened this issue Jan 10, 2013 · 4 comments

Comments

@Gamaroff
Copy link
Collaborator

Is it possible to do BETWEEN queries with the current code or would I need to develop new code to do this?

@dresende
Copy link
Owner

It's not possible, you need to develop code for now.

@dresende
Copy link
Owner

I just checked all 3 drivers and the syntax is the same so it is a good addition. I just don't know yet the best syntax for this.

@dresende
Copy link
Owner

I'm thinking about exposing some "special" functions to create "special" objects to use in conditions.

Person.find({ age: orm.between(20, 30) }, ....);

This.between() would return a common object with a non-enumerable function that would tell the sql builder what thing it is.. this could be used for other things:

Person.find({ age: orm.greater(20) }, ...);

@Gamaroff
Copy link
Collaborator Author

That sounds great. Very powerful indeed.

dresende added a commit that referenced this issue Jan 10, 2013
 #19)

Example:

```js
Person.find({ age: orm.between(20, 30) }, cb);
```

Other special objects:

- orm.eq(val): equal to val
- orm.ne(val): not equal to val
- orm.gt(val): greater than val
- orm.gte(val): greater or equal to val
- orm.lt(val): lesser than val
- orm.lte(val): lesser or equal to val
dxg added a commit that referenced this issue Sep 19, 2017
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