Skip to content

Commit

Permalink
[COAPL-1355]: Replace elixir_uuid with uniq in Avrogen (#20)
Browse files Browse the repository at this point in the history
* replace elixir_uuid with uniq

* remove elixir_uuid from lock file

* bump version to 0.8.0
  • Loading branch information
kipters authored Jan 22, 2025
1 parent 18dac83 commit 48b530e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/avrogen/avro/types/logical/uuid.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defimpl CodeGenerator, for: Logical.UUID do
def encode_function(%Logical.UUID{}, function_name, _global) do
quote do
defp unquote(function_name)(uuid) when is_binary(uuid) do
case UUID.info(uuid) do
case Uniq.UUID.info(uuid) do
{:ok, _} -> uuid
{:error, error} -> raise ArgumentError, message: inspect(error)
end
Expand All @@ -48,7 +48,7 @@ defimpl CodeGenerator, for: Logical.UUID do
def decode_function(%Logical.UUID{}, function_name, _global) do
quote do
defp unquote(function_name)(uuid) do
case UUID.info(uuid) do
case Uniq.UUID.info(uuid) do
{:ok, _} -> {:ok, uuid}
{:error, error} -> {:error, error}
end
Expand All @@ -60,7 +60,7 @@ defimpl CodeGenerator, for: Logical.UUID do

def drop_pii(%Logical.UUID{}, function_name, _global) do
quote do
def unquote(function_name)(value) when is_binary(value), do: UUID.uuid4()
def unquote(function_name)(value) when is_binary(value), do: Uniq.UUID.uuid4()
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/avrogen/util/random.ex
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ defmodule Avrogen.Util.Random do
end
end

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

def map(value_constructor, opts \\ []) do
max_length = Keyword.get(opts, :max_map_length, 10)
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Avrogen.MixProject do
use Mix.Project

@version "0.7.2"
@version "0.8.0"
@source_url "https://github.com/primait/avrogen"

def project do
Expand Down Expand Up @@ -40,14 +40,14 @@ defmodule Avrogen.MixProject do
{:decimal, "~> 2.0"},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:erlavro, "~> 2.9"},
{:elixir_uuid, "~> 1.2"},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:excribe, "~> 0.1"},
{:jason, "~> 1.0"},
{:libgraph, "~> 0.16"},
{:noether, "~> 0.2"},
{:timex, "~> 3.6"},
{:typed_struct, "~> 0.3"}
{:typed_struct, "~> 0.3"},
{:uniq, "~> 0.1"}
]
end

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"dialyxir": {:hex, :dialyxir, "1.4.4", "fb3ce8741edeaea59c9ae84d5cec75da00fa89fe401c72d6e047d11a61f65f70", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "cd6111e8017ccd563e65621a4d9a4a1c5cd333df30cebc7face8029cacb4eff6"},
"earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"},
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
"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"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"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"},
Expand All @@ -34,4 +33,5 @@
"typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"},
"tzdata": {:hex, :tzdata, "1.1.2", "45e5f1fcf8729525ec27c65e163be5b3d247ab1702581a94674e008413eef50b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "cec7b286e608371602318c414f344941d5eb0375e14cfdab605cca2fe66cba8b"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
}
2 changes: 1 addition & 1 deletion test/avro/types/logical_types_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ defmodule Avrogen.Avro.Types.LogicalTypesTest do
test "a uuid value expressed as string" do
assert {:error, _} = decode_uuid("test")

uuid = UUID.uuid4()
uuid = Uniq.UUID.uuid4()
assert {:ok, ^uuid} = decode_uuid(uuid)

assert_raise ArgumentError, fn ->
Expand Down

0 comments on commit 48b530e

Please sign in to comment.