Skip to content

Instantly share code, notes, and snippets.

@Linicks
Created May 26, 2015 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Linicks/29267d895efffdbc644c to your computer and use it in GitHub Desktop.
Save Linicks/29267d895efffdbc644c to your computer and use it in GitHub Desktop.
Proper Elixir Control Structure ?
def authors(cd) do
#Connect to the database.
conn = RethinkDB.connect([host: "10.0.0.30", port: 28015])
#Create ore Destroy the authors table.
if cd == "create" do
q = table_create("authors")
|> run conn
end
if cd == "destroy" do
q = table_drop("authors")
|> run conn
end
results = inspect(q.data)
IO.puts "#{results}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment