Skip to content

Commit

Permalink
[docs]
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetised committed Nov 5, 2024
1 parent 143db88 commit 10351cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ defmodule Electric.Client.Authenticator.MockAuthenticator do
@moduledoc """
A pseudo-authenticating `Electric.Client.Authenticator` implementation.
This appends a parameter to the `Request` URL, the value of which depends on
the `Request` itself, but that parameter is meaningless for authentication.
This generates fake authentication headers, useful for validating that the
`Authenticator` behaviour is being called correctly.
"""

@behaviour Electric.Client.Authenticator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Electric.Client.Authenticator.Unauthenticated do
@moduledoc """
Placeholder `Electric.Client.Authenticator` implementation that doesn't add
any authentication params to the `Request`.
any authentication params or headers to the `Request`.
"""

@behaviour Electric.Client.Authenticator
Expand Down
9 changes: 4 additions & 5 deletions packages/elixir-client/lib/electric/client/value_mapper.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule Electric.Client.ValueMapper do
@moduledoc """
A behaviour for mapping the value fields of `Message.ChangeMessage` messages
A behaviour for mapping the `value` fields of [`Message.ChangeMessage`](`Electric.Client.Message.ChangeMessage`) messages
from the shape stream.
This requires implementing a single function `for_schema/2`.
This requires implementing a single function `c:for_schema/2`.
Electric sends schema information with every response. For example the schema
of the `foo` table from the [Electric
Expand All @@ -15,7 +15,7 @@ defmodule Electric.Client.ValueMapper do
value: %{type: "float8"}
}
The `for_schema/2` function receives this schema as the first argument and it
The `c:for_schema/2` function receives this schema as the first argument and it
must return a 1-arity function that will map the value structs received from
Electric to the desired format.
Expand All @@ -37,10 +37,9 @@ defmodule Electric.Client.ValueMapper do
"value" => "45.6"
}
mapper_fun.(value)
# the mapping parses the integer and float values to their respective
# Elixir/Erlang types.
mapper_fun.(value)
%{
"id" => 1,
"name" => "James",
Expand Down

0 comments on commit 10351cd

Please sign in to comment.