Skip to content

Commit 48b530e

Browse files
authored
[COAPL-1355]: Replace elixir_uuid with uniq in Avrogen (#20)
* replace elixir_uuid with uniq * remove elixir_uuid from lock file * bump version to 0.8.0
1 parent 18dac83 commit 48b530e

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/avrogen/avro/types/logical/uuid.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ defimpl CodeGenerator, for: Logical.UUID do
3737
def encode_function(%Logical.UUID{}, function_name, _global) do
3838
quote do
3939
defp unquote(function_name)(uuid) when is_binary(uuid) do
40-
case UUID.info(uuid) do
40+
case Uniq.UUID.info(uuid) do
4141
{:ok, _} -> uuid
4242
{:error, error} -> raise ArgumentError, message: inspect(error)
4343
end
@@ -48,7 +48,7 @@ defimpl CodeGenerator, for: Logical.UUID do
4848
def decode_function(%Logical.UUID{}, function_name, _global) do
4949
quote do
5050
defp unquote(function_name)(uuid) do
51-
case UUID.info(uuid) do
51+
case Uniq.UUID.info(uuid) do
5252
{:ok, _} -> {:ok, uuid}
5353
{:error, error} -> {:error, error}
5454
end
@@ -60,7 +60,7 @@ defimpl CodeGenerator, for: Logical.UUID do
6060

6161
def drop_pii(%Logical.UUID{}, function_name, _global) do
6262
quote do
63-
def unquote(function_name)(value) when is_binary(value), do: UUID.uuid4()
63+
def unquote(function_name)(value) when is_binary(value), do: Uniq.UUID.uuid4()
6464
end
6565
end
6666

lib/avrogen/util/random.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ defmodule Avrogen.Util.Random do
380380
end
381381
end
382382

383-
def uuid(_opts \\ []), do: fn rand_state -> {rand_state, UUID.uuid4()} end
383+
def uuid(_opts \\ []), do: fn rand_state -> {rand_state, Uniq.UUID.uuid4()} end
384384

385385
def map(value_constructor, opts \\ []) do
386386
max_length = Keyword.get(opts, :max_map_length, 10)

mix.exs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Avrogen.MixProject do
22
use Mix.Project
33

4-
@version "0.7.2"
4+
@version "0.8.0"
55
@source_url "https://github.com/primait/avrogen"
66

77
def project do
@@ -40,14 +40,14 @@ defmodule Avrogen.MixProject do
4040
{:decimal, "~> 2.0"},
4141
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
4242
{:erlavro, "~> 2.9"},
43-
{:elixir_uuid, "~> 1.2"},
4443
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
4544
{:excribe, "~> 0.1"},
4645
{:jason, "~> 1.0"},
4746
{:libgraph, "~> 0.16"},
4847
{:noether, "~> 0.2"},
4948
{:timex, "~> 3.6"},
50-
{:typed_struct, "~> 0.3"}
49+
{:typed_struct, "~> 0.3"},
50+
{:uniq, "~> 0.1"}
5151
]
5252
end
5353

mix.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
88
"dialyxir": {:hex, :dialyxir, "1.4.4", "fb3ce8741edeaea59c9ae84d5cec75da00fa89fe401c72d6e047d11a61f65f70", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "cd6111e8017ccd563e65621a4d9a4a1c5cd333df30cebc7face8029cacb4eff6"},
99
"earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"},
10-
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
1110
"erlavro": {:hex, :erlavro, "2.9.10", "8435e24d390bdd400adecc670e7b1b3d037863fbbc6ba5afa1ad78926a5379e6", [:make, :rebar3], [{:jsone, "1.8.1", [hex: :jsone, repo: "hexpm", optional: false]}, {:snappyer, "1.2.9", [hex: :snappyer, repo: "hexpm", optional: false]}], "hexpm", "1a87b785b89b14db7300b6450c034c21cbf3001ca7b7067c93bb18e10bcd9e49"},
1211
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
1312
"ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"},
@@ -34,4 +33,5 @@
3433
"typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"},
3534
"tzdata": {:hex, :tzdata, "1.1.2", "45e5f1fcf8729525ec27c65e163be5b3d247ab1702581a94674e008413eef50b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "cec7b286e608371602318c414f344941d5eb0375e14cfdab605cca2fe66cba8b"},
3635
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
36+
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
3737
}

test/avro/types/logical_types_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule Avrogen.Avro.Types.LogicalTypesTest do
6666
test "a uuid value expressed as string" do
6767
assert {:error, _} = decode_uuid("test")
6868

69-
uuid = UUID.uuid4()
69+
uuid = Uniq.UUID.uuid4()
7070
assert {:ok, ^uuid} = decode_uuid(uuid)
7171

7272
assert_raise ArgumentError, fn ->

0 commit comments

Comments
 (0)