Packages
amqp
1.4.0
4.1.1
4.1.0
4.0.0
4.0.0-rc.1
3.3.2
3.3.1
retired
3.3.0
3.2.0
3.1.1
3.1.0
3.0.1
3.0.0
3.0.0-rc.1
2.1.2
2.1.1
2.1.0
2.0.0
2.0.0-rc.2
2.0.0-rc.1
1.6.0
1.5.0
1.4.2
1.4.1
1.4.0
1.4.0-rc.0
1.3.2
1.3.1
1.3.0
1.2.2
1.2.1
1.2.0
1.2.0-rc.0
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-pre.4
1.0.0-pre.3
1.0.0-pre.2
1.0.0-pre.1
0.3.1
0.3.0
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.2.0-pre.2
0.2.0-pre.1
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.6
0.0.5
0.0.4
0.0.3
Idiomatic Elixir client for RabbitMQ.
Current section
Files
Jump to
Current section
Files
lib/amqp/utils.ex
defmodule AMQP.Utils do
@moduledoc false
@doc "Converts a keyword list into a rabbit_common compatible type tuple"
def to_type_tuple(fields) when is_list(fields) do
Enum.map(fields, &to_type_tuple/1)
end
def to_type_tuple(:undefined), do: :undefined
def to_type_tuple({name, type, value}), do: {to_string(name), type, value}
def to_type_tuple({name, value}) when is_boolean(value) do
to_type_tuple({name, :bool, value})
end
def to_type_tuple({name, value}) when is_bitstring(value) or is_atom(value) do
to_type_tuple({name, :longstr, to_string(value)})
end
def to_type_tuple({name, value}) when is_integer(value) do
to_type_tuple({name, :long, value})
end
def to_type_tuple({name, value}) when is_float(value) do
to_type_tuple({name, :float, value})
end
end