defmodule Main do
def main() do
http_map = %{"type" => "http", "http" => "http config"}
tcp_map = %{"type" => "tcp", "tcp" => "tcp config"}
handle(http_map)
handle(tcp_map)
end
def handle(map=%{"type" => "http"}) do
IO.puts "http handler: " <> map["http"]
end
def handle(map=%{"type" => "tcp"}) do
IO.puts "tcp handler: " <> map["tcp"]
end
end
Main.main