-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Dataset#virtual_row_block_call with Sequel.virtual_row
This removes the private virtual_row_block_call Dataset instance method, replacing with the Sequel.virtual_row module method. The API is slightly different, with virtual_row_block_call taking the block as a regular argument, and Sequel.virtual_row taking it as a block. This allows the easier use of virtual rows outside of the select, order, and filter calls. For example: net_benefit = Sequel.virtual_row{revenue > cost} good_employee = Sequel.virtual_row{num_commendations > 0} fire = ~net_benefit & ~good_employee demote = ~net_benefit & good_employee promote = net_benefit & good_employee DB[:employees].filter(fire).update(:employed=>false) DB[:employees].filter(demote).update(:rank=>:rank-1) DB[:employees].filter(promote).update(:rank=>:rank+1) There wasn't an easy way to do the above before, without creating the Sequel::SQL::VirtualRow instance manually.
- Loading branch information
1 parent
d0a98fa
commit f62c1e1
Showing
4 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters