Created
November 20, 2010 16:42
-
-
Save StanAngeloff/707950 to your computer and use it in GitHub Desktop.
Nope, this is not some fancy non-ANSI SQL; this is CoffeeScript
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
| SELECT = (map, results) -> map.call each for each in results | |
| FROM = (list, reduce) -> each for each in list when reduce each | |
| WHERE = (reduce) -> (each) -> reduce.call each |
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
| SELECT -> { @name }, | |
| FROM Users, | |
| WHERE -> @age > 18 and @age < 64 |
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
| SELECT(function() { | |
| return { | |
| name: this.name | |
| }; | |
| }, FROM(Users, WHERE(function() { | |
| return this.age > 18 && this.age < 64; | |
| }))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment