Created
July 29, 2013 22:21
-
-
Save jschoch/6108430 to your computer and use it in GitHub Desktop.
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
def do_select(s) do | |
Amnesia.transaction do | |
case __MODULE__.select(s) do | |
nil -> [] | |
selector -> selector.values | |
end | |
end | |
end | |
def all(key,operator,value) do | |
case key do | |
:id -> all_by_id(operator,value) | |
:updated_at -> | |
end | |
end | |
def all_by_id(operator,value) do | |
case operator do | |
:gt -> | |
s = Exquisite.match Company, | |
where: id > value | |
doh -> "Ut oh! #{doh}" | |
end | |
Company.do_select(s) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment