Skip to content

Commit

Permalink
Get rid of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cichacz committed Dec 17, 2024
1 parent 797ef23 commit 0b6a28d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/neo4ex/bolt_protocol/structure.ex
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ defmodule Neo4ex.BoltProtocol.Structure do

# embedded structure must be a map but we should take advantage of field versioning
defp embedded_encoder_protocol(fields_list) do
# When default values contain some data from module (like values from attributes) it won't be visible inside defimpl (different module)
# For protocol we need only version so this is completely fine
fields_list =
Enum.map(fields_list, fn {field, opts} -> {field, [version: opts[:version]]} end)

quote location: :keep do
defimpl Neo4ex.BoltProtocol.Encoder do
def encode(struct, bolt_version) do
Expand All @@ -170,6 +175,11 @@ defmodule Neo4ex.BoltProtocol.Structure do
end

defp encoder_protocol(fields_list) do
# When default values contain some data from module (like values from attributes) it won't be visible inside defimpl (different module)
# For protocol we need only version so this is completely fine
fields_list =
Enum.map(fields_list, fn {field, opts} -> {field, [version: opts[:version]]} end)

quote location: :keep do
defimpl Neo4ex.BoltProtocol.Encoder do
alias Neo4ex.PackStream.{Markers, Exceptions}
Expand Down
3 changes: 1 addition & 2 deletions lib/neo4ex/bolt_protocol/structure/message/extra/hello.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Neo4ex.BoltProtocol.Structure.Message.Extra.Hello do
use Neo4ex.BoltProtocol.Structure

@version Mix.Project.config()[:version]
@system_info System.build_info()[:version]

# can't be encoded directly, it's just helper for the Hello message
embeded_structure do
Expand All @@ -11,7 +10,7 @@ defmodule Neo4ex.BoltProtocol.Structure.Message.Extra.Hello do
field(:bolt_agent,
default: %{
product: "Neo4ex/#{@version}",
language: "Elixir/#{@system_info}"
language: "Elixir/#{System.build_info()[:version]}"
},
version: ">= 5.3.0"
)
Expand Down

0 comments on commit 0b6a28d

Please sign in to comment.