Skip to content

Commit

Permalink
Add query proxy for whereIn()
Browse files Browse the repository at this point in the history
  • Loading branch information
radmen committed May 13, 2020
1 parent 275cb74 commit bf888e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- This CHANGELOG
- Query proxy for `whereIn()` method

### Changed

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const activeUsers = await User.query()
In some cases, you can omit the `query()` method and start chaining using following methods:

- `where()`
- all scope methods
- `whereIn()`
- `insert()`
- `returning()`

Expand Down
1 change: 1 addition & 0 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const { KexError } = require('./errors')

const proxyQueryMethods = [
'where',
'whereIn',
'insert',
'returning'
]
Expand Down
5 changes: 5 additions & 0 deletions tests/query-proxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ test('returning()', proxyMacro, {
expectedFn: User => User.query().returning('id').insert({ active: true }),
actualFn: User => User.returning('id').insert({ active: true })
})

test('wherIn', proxyMacro, {
expectedFn: User => User.query().whereIn('id', [1]),
actualFn: User => User.whereIn('id', [1])
})

0 comments on commit bf888e0

Please sign in to comment.