Created
August 8, 2010 02:33
-
-
Save wilig/513486 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sequel> (filter (> :projects/id 5) (collect :projects)) | |
"select * from projects where projects.id > 5" | |
sequel> (filter (and (> :projects/id 2) (= :projects/name "sequel")) (collect :projects)) | |
"select * from projects where projects.id > 2 AND projects.name = 'sequel'" | |
sequel> (filter (and (in :projects/id [1 2 3 4 5 6 7 8 9 10]) (= :projects/name "sequel")) (collect :projects)) | |
"select * from projects where projects.id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND projects.name = 'sequel'" | |
sequel> (filter (and (in :projects/id [1 2 3 4 5 6 7 8 9 10]) (like :projects/name "seq%")) (collect :projects)) | |
"select * from projects where projects.id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND projects.name like 'seq%'" | |
sequel> (filter (or (and (> :project/id 5) (= :project/name "sequel")) (= :project/id 15)) (collect :projects)) | |
"select * from projects where project.id > 5 AND project.name = 'sequel' OR project.id = 15" | |
sequel> ;; Oops, nesting doesn't work! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment