Rill v0.10.4 Rill.Messaging.Message.Dictionary behaviour View Source
Converts messages from database representation to the related struct
Link to this section Summary
Functions
Provides def
macro and sets up dictionary
callback
Defines a function and appends the type of the first argument (must be a struct) to the dictionary of the module
Link to this section Types
Used as a dictionary to convert a type name (text) into its related module
Link to this section Functions
Link to this macro
__using__(opts \\ []) View Source (macro)
Provides def
macro and sets up dictionary
callback
Link to this macro
def(head, list) View Source (macro)
Defines a function and appends the type of the first argument (must be a struct) to the dictionary of the module.
Examples
defmodule Foo.Bar do
defstruct [:name, :age]
end
defmodule Projection do
alias Foo.Bar
def apply(%Bar{} = bar, entity) do
# ...
end
end
Rill.Message.Dictionary.get_dictionary(Projection)
# %Projection{type_names: %{"Bar" => Foo.Bar}}
Link to this function
get_dictionary(module) View Source
Link to this function
translate(module, message_data)
View Source
translate(module, message_data)
View Source
translate(
module :: module(),
message_data :: %Rill.MessageStore.MessageData.Read{
data: term(),
global_position: term(),
id: term(),
metadata: term(),
position: term(),
stream_name: term(),
time: term(),
type: term()
}
) :: nil | struct()
translate(
dictionary :: %Rill.Messaging.Message.Dictionary{type_names: term()},
message_data :: %Rill.MessageStore.MessageData.Read{
data: term(),
global_position: term(),
id: term(),
metadata: term(),
position: term(),
stream_name: term(),
time: term(),
type: term()
}
) :: nil | struct()
translate( module :: module(), message_data :: %Rill.MessageStore.MessageData.Read{ data: term(), global_position: term(), id: term(), metadata: term(), position: term(), stream_name: term(), time: term(), type: term() } ) :: nil | struct()
translate( dictionary :: %Rill.Messaging.Message.Dictionary{type_names: term()}, message_data :: %Rill.MessageStore.MessageData.Read{ data: term(), global_position: term(), id: term(), metadata: term(), position: term(), stream_name: term(), time: term(), type: term() } ) :: nil | struct()
Link to this function
translate_name(dictionary, type) View Source
Link to this section Callbacks
Link to this callback
dictionary()
View Source
dictionary()
View Source
dictionary() :: %Rill.Messaging.Message.Dictionary{type_names: term()}
dictionary() :: %Rill.Messaging.Message.Dictionary{type_names: term()}